#include <iostream>
#include <vector>
#include <fstream>
using namespace std;
ifstream fin("datorii.in");
ofstream fout("datorii.out");
vector<long long>a,nod;
int n,q;
void build(int node,int st, int dr){
if(st==dr){
nod[node] = a[st];
return;
}
int mid = (st+dr)/2;
build(node * 2,st,mid);
build((node * 2)+1,mid+1,dr);
nod[node] = nod[node*2] + nod[(node*2)+1];
}
void update(int node,int st,int dr,int poz,int v){
if(st == dr){
nod[node] -= v;
return;
}
int mid = (st+dr)/2;
if(poz <=mid)
update(node * 2,st,mid,poz,v);
else
update((node*2)+1,mid+1,dr,poz,v);
nod[node] = nod[node*2] + nod[(node*2)+1];
}
long long qeu(int node,int st,int dr,int l,int r){
if(dr < l || st > r)
return 0;
if(l <= st && dr <= r)///suntem in interval
return nod[node];
int mid = (st+dr)/2;
return qeu(node*2,st,mid,l,r) + qeu((node*2)+1,mid+1,dr,l,r);
}
int main()
{
fin>>n>>q;
a.resize(n+1,0);
nod.resize(400002,0);
for(int i=1;i<=n;i++)
fin>>a[i];
build(1,1,n);
for(int i=1;i<=q;i++){
int c;
fin>>c;
if(c==0){
int k,u;
fin>>k>>u;///de la poz k devine u
update(1,1,n,k,u);
}
else{
int x,y;
fin>>x>>y;
fout<<qeu(1,1,n,x,y)<<'\n';
}
}
return 0;
}