#include <fstream>
using namespace std;
ifstream in("datorii.in");
ofstream out("datorii.out");
int N,M,AI[15010];
void achitare(int nod,int st,int dr,int poz,int val)
{
if(st==dr)
{
AI[nod]+=val;
}
else
{
int m=(st+dr)/2;
if(poz<=m)
achitare(2*nod,st,m,poz,val);
else
achitare(2*nod+1,m+1,dr,poz,val);
AI[nod]=AI[2*nod]+AI[2*nod+1];
}
}
void interogare(int nod,int st,int dr,int a,int b,int &sol)
{
if(a<=st && b>=dr) sol+=AI[nod];
else
{
int m=(st+dr)/2;
if(a<=m)
interogare(2*nod,st,m,a,b,sol);
if(b>m)
interogare(2*nod+1,m+1,dr,a,b,sol);
}
}
int main()
{
in>>N>>M;
for(int i=1;i<=N;i++)
{
int c;
in>>c;
achitare(1,1,N,i,c);
}
int T,A,B;
while(M--)
{
in>>T>>A>>B;
if(T)
{
int sol=0;
interogare(1,1,N,A,B,sol);
out<<sol<<'\n';
}
else achitare(1,1,N,A,-B);
}
in.close();out.close();return 0;
}