#include <bits/stdc++.h>
using namespace std;
ifstream fin("datorii.in");
ofstream fout("datorii.out");
int n,m,V[15005],A[65000],c,t,v;
void build(int nod, int st, int dr)
{
if(st == dr)
{
A[nod] = V[st];
return;
}
int mid = (st+dr)/2;
build(2*nod,st,mid);
build(2*nod+1,mid+1,dr);
A[nod] = A[2*nod] + A[2*nod+1];
}
void update(int nod, int st, int dr, int poz, int val)
{
if(st == dr)
{
A[nod] -= val;
return;
}
int mid = (st+dr)/2;
if(mid<poz)
{
update(2*nod+1,mid+1,dr,poz,val);
}
else{
update(2*nod,st,mid,poz,val);
}
A[nod] = A[2*nod] + A[2*nod+1];
}
int query(int nod, int st, int dr, int a, int b)
{
if(st >= a && dr <= b)
{
return A[nod];
}
int mid = (st+dr)/2;
int sol = 0;
if(a<=mid)
{
sol += query(2*nod,st,mid,a,b);
}
if(b>mid)
{
sol += query(2*nod+1,mid+1,dr,a,b);
}
return sol;
}
int main()
{
fin>>n>>m;
for(int i = 1;i<=n;i++)
fin>>V[i];
build(1,1,n);
for(int i = 1;i<=m;i++)
{
fin>>c>>t>>v;
if(c == 0)
update(1,1,n,t,v);
else
fout<<query(1,1,n,t,v)<<'\n';
}
}