#include <bits/stdc++.h>
using namespace std;
int arb[60005],n,m;
void update(int val, int pos, int node, int st, int dr){
if (st==dr){
arb[node]+=val;return;
}
int mid=(st+dr)/2;
if (pos<=mid){
update(val, pos, node*2, st, mid);
}
else{
update(val, pos, node*2+1, mid+1, dr);
}
arb[node]=arb[node*2]+arb[node*2+1];
}
int query(int l, int r, int node, int st, int dr){
if (l<=st && dr<=r){
return arb[node];
}
int mid=(st+dr)/2;
int x=0, y=0;
if (l<=mid){
x=query(l, r, node*2, st, mid);
}
if (r>=mid+1){
y=query(l, r, node*2+1, mid+1, dr);
}
return x+y;
}
int main()
{
freopen("datorii.in", "r", stdin);
freopen("datorii.out", "w", stdout);
ios::sync_with_stdio(false);
cin.tie(nullptr);
cin>>n>>m;
for (int i=1;i<=n;i++){
int x;cin>>x;
update(x, i, 1, 1, n);
}
while (m--){
int q,l,r;cin>>q>>l>>r;
if (q==0){
update(-r, l, 1, 1, n);
}
else{
cout<<query(l,r,1,1,n)<<'\n';
}
}
return 0;
}