#include<stdio.h>
#define max(a,b) a>b?a:b
int arb[99999999],n,q;
void update(int nod,int st,int dr,int poz,int val)
{
if(st==poz&&dr==poz)arb[nod]+=val;
else
{
int m=(st+dr)/2;
int nod2;
if(poz<=m)
{
update(nod*2,st,m,poz,val);
nod2=nod*2;
}
else
{
nod2=nod*2+1;
update(nod*2+1,m+1,dr,poz,val);
}
arb[nod]+=val;
}
}
int getRest(int nod,int st,int dr,int a,int b)
{
if(a<=st&&dr<=b)return arb[nod];
else
{
int x1=0,x2=0;
int m=(st+dr)/2;
if(a<=m)x1=getRest(nod*2,st,m,a,b);
if(b>m)x2=getRest(nod*2+1,m+1,dr,a,b);
return x1+x2;
}
}
int main()
{
freopen("datorii.in","r",stdin);
freopen("datorii.out","w",stdout);
scanf("%d %d\n",&n,&q);
for(int i=1;i<=n;i++)
{
int x;
scanf("%d",&x);
update(1,1,n,i,x);
}
scanf("\n");
for(int i=0;i<q;i++)
{
int cmd,a,b;
scanf("%d %d %d\n",&cmd,&a,&b);
if(cmd==0)update(1,1,n,a,-b);
else printf("%d\n",getRest(1,1,n,a,b));
}
}