#include <fstream>
#include <vector>
using namespace std;
ifstream in ("datorii.in");
ofstream out ("datorii.out");
int n,m;
vector <int> aint;
void update(int node, int from, int to, int pos, int val)
{
if (from==to) {aint[node]+=val; return;}
int mid=(from+to)/2;
if (pos<=mid)
{
update(node*2, from, mid, pos, val);
}
else update(node*2+1, mid+1, to, pos, val);
aint[node]=aint[node*2]+aint[node*2+1];
}
int query(int node, int from, int to, int le, int ri)
{
if(le>ri)
return 0;
if (le==from && ri==to) return aint[node];
int mid=(from+to)/2;
int sum=0;
if (le<=mid) sum+=query(node*2, from, mid, le, min(mid,ri));
if (ri>mid) sum+=query(node*2+1, mid+1, to, max(mid+1,le), ri);
return sum;
}
int main()
{
in>>n>>m;
aint.assign(4*n+5, 0);
for (int i=1; i<=n; i++)
{
int a; in>>a;
update(1,1,n,i,a);
}
for (int i=0; i<m; i++)
{
int a,b,c; in>>a>>b>>c;
if (a==0) update(1,1,n,b,-c);
else out<<query(1,1,n,b,c)<<"\n";
}
return 0;
}