# include <stdio.h>
# define input "datorii.in"
# define output "datorii.out"
# define max 15001
long n,k,i,j,x,y,t[max],v;
void pune(long m,long st,long dr,long y,long x)
{
t[m]+=x;
long mij=(st+dr)>>1;
if(st == dr)return;
if(y<=mij)
pune(m<<1,st,mij,y,x);
if(mij<y)
pune((m<<1)+1,mij+1,dr,y,x);
}
long det(long m,long st,long dr,long x,long y)
{
if(x <= st && dr <= y)
return t[m];
else
{
long s = 0,mij = (st+dr)>>1;
if(mij >= x)
s+=det(m<<1,st,mij,x,y);
if(mij+1 <= y)
s+=det((m<<1)+1,mij+1,dr,x,y);
return s;
}
}
int main()
{
freopen(input,"r",stdin);
freopen(output,"w",stdout);
scanf("%ld%ld",&n,&k);
for(i =1;i<=n;i++)
{
scanf("%ld",&x);
if(x)
pune(1,1,n,i,x);
}
for(i = 1;i<=k;i++)
{
scanf("%d",&v);
if(v == 0)
{
scanf("%ld%ld",&y,&x);
pune(1,1,n,y,-x);
}
else
{
scanf("%ld%ld",&x,&y);
printf("%ld\n",det(1,1,n,x,y));
}
}
return 0;
}