#include<cstdio>
using namespace std;
FILE *f=fopen("datorii.in","r");
FILE *g=fopen("datorii.out","w");
int n,v[300000],poz,sum;
void update1(int i,int left,int right,int x)
{
if(left==right)v[i]+=x;
else
{
int m=(left+right)/2;
if(m<poz)
update1(2*i+1,m+1,right,x);
else update1(2*i,left,m,x);
v[i]=v[2*i]+v[2*i+1];
}
}
void summ(int i,int left,int right,int l,int r)
{
if(left==l&&right==r){sum+=v[i];return;}
int m=(left+right)/2;
if(r<=m)
summ(2*i,left,m,l,r);
else
if(l>m)
summ(2*i+1,m+1,right,l,r);
else{
summ(2*i,left,m,l,m);
summ(2*i+1,m+1,right,m+1,r);
}
}
int main()
{
int m,k,x,i,cer,r,y;
fscanf(f,"%d%d",&n,&m);
for(k=1;k<=n;k++)
{
fscanf(f,"%d",&x);
poz=k;
update1(1,1,n,x);
}
for(i=1;i<=m;i++)
{
fscanf(f,"%d%d%d",&cer,&x,&y);
if(cer==1)
{
sum=0;
summ(1,1,n,x,y);
fprintf(g,"%d\n",sum);
}
else
{
poz=x;
update1(1,1,n,-y);
}
}
return 0;
}