#include <fstream>
using namespace std;
ifstream fin("datorii.in");
ofstream fout("datorii.out");
const int nMax=15e3+5;
int Tree[4*nMax];
void build_tree(int node, int left_son, int right_son)
{
if(left_son==right_son)
fin>>Tree[node];
else
{
int m=(left_son+right_son)>>1;
build_tree(2*node, left_son, m);
build_tree(2*node+1, m+1, right_son);
Tree[node]=Tree[2*node] + Tree[2*node+1];
}
}
void update(int node, int left_son, int right_son, int a, int b)
{
if(left_son==right_son)
Tree[node]-=b;
else
{
int m=(left_son+right_son)>>1;
if(a<=m)
update(2*node, left_son, m, a, b);
else update(2*node+1, m+1, right_son, a, b);
Tree[node]=Tree[2*node] + Tree[2*node+1];
}
}
int query(int node, int left_son, int right_son, int a, int b)
{
if(left_son==right_son)
return Tree[node];
else
{
int m=(left_son+right_son)>>1;
if(b<=m)
return query(2*node, left_son, m, a, b);
if(m+1<=a)
return query(2*node+1, m+1, right_son, a, b);
return query(2*node, left_son, m, a, b) + query(2*node+1, m+1, right_son, a, b);
}
}
int main()
{
ios_base::sync_with_stdio(false);
fin.tie(0);
int n, m, op, a, b;
fin>>n>>m;
build_tree(1, 1, n);
for(int i=0; i<m; i++)
{
fin>>op>>a>>b;
if(op==0)
update(1, 1, n, a, b);
else fout<<query(1, 1, n, a, b)<<'\n';
}
fin.close();
fout.close();
return 0;
}