#include <stdio.h>
using namespace std;
FILE *f=fopen("datorii.in","r");
FILE *g=fopen("datorii.out","w");
int n,m,a[105000],x,sum,pos,val,p,u,i;
void update(int nod,int l,int r)
{
int m;
if (l==r)a[nod]=a[nod]-val;
else
{
m=(l+r)/2;
if (pos<=m)update(2*nod,l,m);
else update(2*nod+1,m+1,r);
}
a[nod]=a[2*nod]+a[2*nod+1];
}
void reupdate(int nod,int l,int r)
{
int m;
if (l==r)a[nod]=val;
else
{
m=(l+r)/2;
if (pos<=m)reupdate(2*nod,l,m);
else reupdate(2*nod+1,m+1,r);
}
//a[nod]=a[2*nod]+a[2*nod+1];
}
void query(int nod,int l,int r)
{
int m;
if (p<=l && r<=u)
{sum+=a[nod];
return;
}
m=(l+r)/2;
if (p<=m)query(2*nod,l,m);
if (m<u)query(2*nod+1,m+1,r);
}
int main()
{
fscanf(f,"%d%d",&n,&m);
for(i=1;i<=n;i++){
fscanf(f,"%d",&val);
pos=i;
reupdate(1,1,n);
}
for(i=1;i<=m;i++)
{
fscanf(f,"%d",&x);
if (x==0)
{
fscanf(f,"%d%d",&pos,&val);
update(1,1,n);
}
else
{
sum=0;
fscanf(f,"%d%d",&p,&u);
query(1,1,n);
fprintf(g,"%d\n",sum);
}
}
fclose(g);
return 0;
}