#include<cstdio>
#define N 15001
#define M 1<<20
int a[M],v[N],n,m,q,x,y;
void build(int nod, int l, int r)
{
if (l==r)
{
a[nod]=v[l];
return;
}
int m=(l+r)>>1;
build(2*nod,l,m);
build(2*nod+1,m+1,r);
a[nod]=a[nod*2]+a[2*nod+1];
}
void update(int nod, int l,int r, int poz, int val)
{
if (l==r)
{
a[nod]=val;
return;
}
int m=(l+r)>>1;
if (poz<=m)
update(nod*2,l,m,poz,val);
else
update(nod*2+1,m+1,r,poz,val);
a[nod]=a[2*nod]+a[2*nod+1];
}
int suma(int nod,int l, int r, int x, int y)
{
if (x<=l&&r<=y)
return a[nod];
int m=(l+r)>>1,i1=0,i2=0;
if (x<=m)
i1=suma(nod*2,l,m,x,y);
if (y>m)
i2=suma(nod*2+1,m+1,r,x,y);
return i1+i2;
}
void citire()
{
freopen("datorii.in","r",stdin);
freopen("datorii.out","w",stdout);
scanf("%d%d",&n,&m);
for (int i=1; i<=n; ++i) scanf("%d",&v[i]);
build(1,1,n);
while (m--)
{
scanf("%d%d%d",&q,&x,&y);
if (!q)
{
v[x]-=y;
update(1,1,n,x,v[x]);
}
else
printf("%d\n",suma(1,1,n,x,y));
}
}
int main()
{
citire();
return 0;
}