#include<bits/stdc++.h>
using namespace std;
int n;
int lowbit(int x) {
    return x & -x;
}
int getsum(int x,vector<int>&c) {  // a[1]..a[x]的和
    int ans = 0;
    while (x > 0) {
        ans = ans + c[x];
        x = x - lowbit(x);
    }
    return ans;
}
void add(int x, int k,vector<int>&c) {
    while (x <= n) {  // 不能越界
        c[x] = c[x] + k;
        x = x + lowbit(x);
    }
}
int main(){
    int m;cin>>n>>m;
    vector<int>a(n+1);
    vector<int>c(4*n);
    for(int i=1;i<=n;i++){
        cin>>a[i];
        add(i,a[i],c);
    }
    for(int i=1;i<=m;i++){
        int type,x,y;
        cin>>type>>x>>y;
        if(type==1){
            add(x,y,c);
            a[x]+=y;
        }
        else cout<<getsum(y,c)-getsum(x-1,c)<<"\n";
    }
    return 0;
}