#include <fstream>
#include <stdio.h>
using namespace std;
#define in "datorii.in"
#define out "datorii.out"
#define Dim 15002
long arb[4*Dim+1], dator[Dim];
long sum;
int t, tip, n, v, k;
void Q(int nod, int st, int dr, int poz1, int poz2);
void Update(int nod, int st, int dr, int poz);
int main()
{
freopen(in,"r",stdin);
freopen(out,"w",stdout);
scanf("%d%d", &n, &k);
sum = 0;
for ( int i = 1; i <= n; i++ )
{
scanf("%d", &dator[i]);
Update(1,1,n,i);
}
for ( int i = 1; i <= k; i++ )
{
scanf("%d%d%d", &tip, &t, &v);
if ( tip == 0 )
{
dator[t] -= v;
Update(1,1,n,t);
}
else
{
Q(1,1,n,t,v);
printf("%d\n",sum);
sum = 0;
}
}
}
void Update(int nod, int st, int dr, int poz)
{
if ( st == dr )
{
arb[nod] = dator[poz];
return;
}
int mij = (st+dr)/2;
if ( poz <= mij ) Update(2*nod,st,mij,poz);
if ( mij < poz ) Update(2*nod+1,mij+1,dr,poz);
arb[nod] = arb[2*nod] + arb[2*nod+1];
}
void Q(int nod, int st, int dr, int poz1, int poz2)
{
if ( poz1 <= st && dr <= poz2 )
{
sum += arb[nod];
return;
}
int mij = (st+dr)/2;
if ( poz1 <= mij ) Q(2*nod,st,mij,poz1,poz2);
if ( mij < poz2 ) Q(2*nod+1,mij+1,dr,poz1,poz2);
}