#include<stdio.h>
#define max(a,b) a>b?a:b
#define MAX 5255
using namespace std;
char buff[MAX];
int arb[99999999],n,q,ind=0;
bool ok=true;
inline void read(int &nr)
{
int x=0;
while(buff[ind]>='0'&&buff[ind]<='9'){x=x*10+buff[ind]-48;ind++;}
while(buff[ind]<'0'||buff[ind]>'9')ind++;
nr=x;
}
void update(int nod,int st,int dr,int poz,int val)
{
if(st==poz&&dr==poz)arb[nod]+=val;
else
{
int m=(st+dr)/2;
int nod2;
if(poz<=m)
{
update(nod*2,st,m,poz,val);
nod2=nod*2;
}
else
{
nod2=nod*2+1;
update(nod*2+1,m+1,dr,poz,val);
}
arb[nod]+=val;
}
}
int getRest(int nod,int st,int dr,int a,int b)
{
if(a<=st&&dr<=b)return arb[nod];
else
{
int x1=0,x2=0;
int m=(st+dr)/2;
if(a<=m)x1=getRest(nod*2,st,m,a,b);
if(b>m)x2=getRest(nod*2+1,m+1,dr,a,b);
return x1+x2;
}
}
int main()
{
freopen("datorii.in","r",stdin);
freopen("datorii.out","w",stdout);
//scanf("%d %d\n",&n,&q);
fread(buff,1,MAX,stdin);
read(n);
read(q);
for(int i=1;i<=n;i++)
{
int x;
//scanf("%d",&x);
read(x);
update(1,1,n,i,x);
}
//scanf("\n");
for(int i=0;i<q;i++)
{
int cmd,a,b;
//scanf("%d %d %d\n",&cmd,&a,&b);
read(cmd);read(a);read(b);
if(cmd==0)update(1,1,n,a,-b);
else printf("%d\n",getRest(1,1,n,a,b));
}
}