#include<bits/stdc++.h>
using namespace std;
ifstream in ("datorii.in");
ofstream out ("datorii.out");
int arbore[100000], v[16000];
void creeaza(int nod, int L, int R)
{
if(L==R)
{
arbore[nod]=v[L-1];
return;
}
creeaza(nod*2+1, (L+R)/2+1, R);
creeaza(nod*2, L, (L+R)/2);
arbore[nod]=arbore[nod*2]+arbore[nod*2+1];
}
void modify(int nod, int L, int R, int poz, int val)
{
if(poz<L || poz>R)
return;
if(L==R)
{
arbore[nod]-=val;
return;
}
if(poz<=(L+R)/2)
modify(nod*2, L, (L + R)/2, poz, val);
else
modify(nod*2+1, (L+R)/2+1, R, poz, val);
arbore[nod]=arbore[nod*2]+arbore[nod*2+1];
}
int suma(int nod, int L, int R, int i, int j)
{
if(R<i || L>j)
return 0;
if(i<=L && j>=R)
return arbore[nod];
return suma(nod*2, L, (L+R)/2, i, j) + suma(nod*2+1, (L + R)/2+1, R, i, j);
}
int main()
{
int n, m, i, op, val, poz, pozFinal;
in>>n>>m;
for(i=0; i<n; i++)
in>>v[i];
creeaza(1, 1, n);
for(i=1; i<=m; i++)
{
in>>op>>poz;
if(op==0)
{
in>>val;
modify(1, 1, n, poz, val);
}
else
{
in>>pozFinal;
out<<suma(1, 1, n, poz, pozFinal)<<'\n';
}
}
return 0;
}