#include <fstream>
using namespace std;
ifstream cin("datorii.in");
ofstream cout("datorii.out");
int A[60005],n,m,i,tip,x,y,sol,v[15005];
void build(int nod,int st,int dr)
{
if(st==dr)
{
A[nod]=v[st];
}
else
{
int mij=(st+dr)/2;
build(2*nod,st,mij);
build(2*nod+1,mij+1,dr);
A[nod]=A[2*nod]+A[2*nod+1];
}
}
void update(int nod,int st,int dr,int p,int x)
{
if(st==dr)
{
A[nod]-=x;
}
else
{
int mij=(st+dr)/2;
if(p<=mij) update(2*nod,st,mij,p,x);
else update(2*nod+1,mij+1,dr,p,x);
A[nod]=A[2*nod]+A[2*nod+1];
}
}
void query(int nod,int st,int dr,int a,int b)
{
if(a<=st&&dr<=b)
{
sol=sol+A[nod];
//cout<<st<<' '<<dr<<' ';
}
else
{
int mij=(st+dr)/2;
if(a<=mij) query(2*nod,st,mij,a,b);
if(b>=mij+1) query(2*nod+1,mij+1,dr,a,b);
}
}
int main()
{
cin>>n>>m;
for(i=1;i<=n;i++)
{
cin>>v[i];
}
build(1,1,n);
while(m--)
{
cin>>tip>>x>>y;
if(tip==0)
{
update(1,1,n,x,y);
}
else
{
sol=0;
query(1,1,n,x,y);
cout<<sol<<'\n';
}
}
return 0;
}