#include <iostream>
#include <fstream>
using namespace std;
ifstream in("datorii.in");
ofstream out("datorii.out");
int t[1<<18];
inline int maxim(int a,int b)
{
if(a>b)
return a;
return b;
}
inline void update(int p, int poz, int val,int st, int dr)
{
int m;
if(st==dr && st==poz)
{
t[p]-=val;
return;
}
m=(st+dr)/2;
if(poz<=m)
update(2*p,poz,val,st,m);
else
update(2*p+1,poz,val,m+1,dr);
t[p]=t[2*p]+t[2*p+1];
}
inline int query(int p,int st, int dr,int a,int b)
{
if(st>=a && b>=dr)
return t[p];
int m1=0,m2=0,m=(st+dr)/2;
if(a<=m)
m1=query(2*p,st,m,a,b);
if(m<b)
m2=query(2*p+1,m+1,dr,a,b);
return m1+m2;
}
int main()
{
int n,q,i,p,a,b;
in>>n>>q;
for(i=1;i<=2*n;++i)
{
t[i]=0;
}
for(i=1;i<=n;++i)
{
in>>p;
update(1,i,-p,1,n);
}
for(i=1;i<=q;++i)
{
in>>p>>a>>b;
if(p==0)
update(1,a,b,1,n);
else
out<<query(1,1,n,a,b)<<"\n";
}
return 0;
}