#include <iostream>
#include <fstream>
using namespace std;
ifstream f("datorii.in");
ofstream g("datorii.out");
int n,m,i,j,nr,x,a,b;
int v[500010];
void update(int nod,int st,int dr,int poz,int val)
{
if (st==dr) v[nod]=v[nod]-val;
else{
int m=(st+dr)/2;
if (poz<=m) update(2*nod,st,m,poz,val);
else update(2*nod+1,m+1,dr,poz,val);
v[nod]=v[nod*2]+v[nod*2+1];
}
}
int query(int nod,int st,int dr,int a,int b)
{
int m,x1=0,x2=0;
if (a<=st && dr<=b) return v[nod];
else
{
m=(st+dr)/2;
if (a<=m) x1=query(2*nod,st,m,a,b);
if (b>=m+1) x2=query(2*nod+1,m+1,dr,a,b);
return x1+x2;
}
}
int main()
{
f>>n>>m;
for (i=1; i<=n; i++)
{
f>>x;
update(1,1,n,i,-x);
}
for (i=1; i<=m; i++)
{
f>>x>>a>>b;
if (x==0) update(1,1,n,a,b);
else g<<query(1,1,n,a,b)<<'\n';
}
return 0;
}