#include <bits/stdc++.h>
using namespace std;
ifstream fin("datorii.in");
ofstream fout("datorii.out");
int n, m;
int tr[45003], a[15001];
void create(int s, int d, int pos){
if(s == d){
tr[pos] = a[s];
return ;
}
int mid = (s+d)/2;
create(s, mid, pos*2+1);
create(mid+1, d, pos*2+2);
tr[pos] = tr[pos*2+1] + tr[pos*2+2];
}
int query(int a, int b, int s, int d, int pos){
if(a<=s && b>=d)
return tr[pos];
if(a > d || b < s)
return 0;
int mid = (s+d)/2;
return query(a,b,s,mid,pos*2+1)+query(a,b,mid+1, d, pos*2+2);
}
void update(int a, int b, int pos, int val, int n){
if(a == b){
tr[n] -= val;
return ;
}
int mid = (a+b)/2;
if (pos <= mid) {
update(a, mid, pos, val, n*2+1);
} else {
update(mid+1, b, pos, val, n*2+2);
}
tr[n] = tr[n*2+1] + tr[n*2+2];
}
int main(){
fin >> n>>m;
for(int i = 0; i<n; i++){
fin>>a[i];
}
create(0, n-1 , 0);
int x, a, b;
for(int i = 0; i<m; i++){
fin >> x>>a>>b;
if(x == 1){
fout<<query(a-1, b-1, 0, n-1, 0)<<"\n";
} else {
update(0, n-1, a-1, b, 0);
}
}
return 0;
}