#include <iostream>
#include <fstream>
using namespace std;
ifstream fin("datorii.in");
ofstream fout("datorii.out");
int Segtree[100001], N, j, v[15001];
void adaugare(int nod, int poz, int left, int right){
//cout<<left<<" "<<right<<endl;
if(left > poz || right < poz)
return;
if(left == right){
//cout<<nod<<endl;
Segtree[nod] += v[poz];
return;
}
adaugare(nod*2, poz, left, (left+right)/2);
adaugare(nod*2+1, poz, (left+right)/2+1, right);
Segtree[nod] = Segtree[2*nod] + Segtree[2*nod+1];
}
void constr(){
for(j = 1; j <= N; j++){
//cout<<endl;
adaugare(1,j,1, N);
}
}
void modif(int nod, int left, int right,int poz, int x){
//cout<<left<<" "<<right<<" "<<poz<<endl;
if(poz < left || poz > right){
//cout<<"acum"<<endl;
return;
}
if(right == left){
Segtree[nod] -= x;
//cout<<"scad"<<endl;
return;
}
modif(nod*2, left, (right+left)/2,poz, x);
modif(nod*2+1, (right+left)/2+1, right,poz, x);
Segtree[nod] = Segtree[2*nod] + Segtree[2*nod+1];
}
int suma(int nod, int left, int right, int s, int r){
if(s > right || left > r)
//cout<<"acum"<<endl;
return 0;
if(s<=left && r>=right)
return Segtree[nod];
return suma(nod*2, left, (right+left)/2, s , r) + suma(nod*2+1, (right+left)/2+1, right, s, r);
}
int main()
{
int M, poz, val, start, stop;
fin>>N>>M;
for(int i = 1; i<=N; i++)
fin>>v[i];
constr();
//for(int i = 1; i<2*N; i++)
//cout<<Segtree[i]<<" ";
//cout<<endl;
for(int i = 0; i<M; i++){
int op;
fin>>op;
if(op==0){
fin>>poz>>val;
modif(1, 1, N, poz, val);
}
else{
fin>>start>>stop;
fout<<suma(1, 1, N, start, stop)<<"\n";
}
}
// for(int i = 1; i<2*N; i++)
// cout<<Segtree[i]<<" ";
}