#include<cstdio>
const int N=1<<15;
int a,b,n,m,x,t[N];
void update(int poz,int st,int dr)
{
if(a<=st && dr<=b)
{
t[poz]+=x;
return;
}
int mid=(st+dr)>>1;
if(a<=mid)
update(poz<<1,st,mid);
if(b>mid)
update((poz<<1)+1,mid+1,dr);
t[poz]=t[poz<<1]+t[(poz<<1)+1];
}
int query(int poz,int st,int dr)
{
if(a<=st && dr<=b)
return t[poz];
int mid=(st+dr)>>1,s=0;
if(a<=mid)
s+=query(poz<<1,st,mid);
if(b>mid)
s+=query((poz<<1)+1,mid+1,dr);
return s;
}
int main()
{
freopen("datorii.in","r",stdin);
freopen("datorii.out","w",stdout);
int i,tip;
scanf("%d%d",&n,&m);
for(i=1;i<=n;++i)
{
scanf("%d",&x);
a=b=i;
update(1,1,n);
}
while(m--)
{
scanf("%d",&tip);
if(tip)
{
scanf("%d%d",&a,&b);
printf("%d\n",query(1,1,n));
}
else
{
scanf("%d%d",&i,&x);
x=-x;
a=b=i;
update(1,1,n);
}
}
return 0;
}