#include<stdio.h>
using namespace std;
int arb[1<<14];
int i,n,m,poz,a,b,rez,op,x;
void update (int nod,int st,int dr) {
if (poz<=st && poz>=dr) {
arb[nod]+=x;
return;
}
int mijloc=(st+dr)/2;
if (poz<=mijloc)
update (2*nod,st,mijloc);
else
update(2*nod+1,mijloc+1,dr);
arb[nod]=arb[2*nod]+arb[2*nod+1];
}
void querry(int nod,int st,int dr) {
int mijloc;
if (a<=st && dr<=b){
rez+=arb[nod];
return;
}
mijloc=(st+dr)/2;
if (a<=mijloc)
querry(2*nod,st,mijloc);
if (b>mijloc)
querry(2*nod+1,mijloc+1,dr);
}
int main () {
freopen("datorii.in","r",stdin);
freopen("datorii.out","w",stdout);
scanf("%d%d",&n,&m);
for (i=1;i<=n;i++) {
scanf("%d",&x);
poz=i;
update(1,1,n);
}
for (i=1;i<=m;i++) {
scanf("%d%d%d",&op,&a,&b);
if (op==0) {
poz=a;
x=-b;
update(1,1,n);
}
else
if (op==1) {
rez=0 ;
querry(1,1,n);
printf("%d\n",rez);
}
}
return 0;
}