#include <bits/stdc++.h>
#define nmax 15001
using namespace std;
ifstream fin("datorii.in");
ofstream fout("datorii.out");
int arb[4*nmax+50];
int n,q,x,y,sum,op,i;
void update(int nod, int st, int dr, int pos, int x)
{
if(st==dr)
{
arb[nod]+=x;
return;
}
int mid=(st+dr)/2;
if(pos<=mid)update(2*nod,st,mid,pos,x);
else update(2*nod+1,mid+1,dr,pos,x);
arb[nod]=arb[2*nod]+arb[2*nod+1];
}
void query(int nod, int st, int dr, int a, int b)
{
if(a<=st && dr<=b)
{
sum+=arb[nod];
return;
}
int mid=(st+dr)/2;
if(a<=mid)query(2*nod,st,mid,a,b);
if(mid<b)query(2*nod+1,mid+1,dr,a,b);
}
int main()
{
fin>>n>>q;
for(i=1;i<=n;i++)
{
fin>>x;
update(1,1,n,i,x);
}
while(q--)
{
fin>>op>>x>>y;
if(op==0)update(1,1,n,x,-y);
else
{
sum=0;
query(1,1,n,x,y);
fout<<sum<<"\n";
}
}
return 0;
}