#include <fstream>
using namespace std;
ifstream fin ("datorii.in");
ofstream fout ("datorii.out");
const int Dim = 15001;
int Tree[Dim * 4 + 55],m,n,t;
int A[Dim],s;
void Update(int node, int le,int ri,int pos, int val)
{
if(le == ri)
{
Tree[node] = val;
return ;
}
int mj = (le + ri) / 2;
if( pos <= mj)
Update(node * 2, le, mj, pos, val);
else
Update(node * 2 + 1, mj + 1, ri, pos, val);
Tree[node] = Tree[node * 2] + Tree[node * 2 + 1];
}
void Query(int node, int le, int ri, int a, int b)
{
if(a <= le and b >= ri)
{
s += Tree[node];
return ;
}
int mj = (le + ri) / 2;
if(a <= mj)
Query(2 * node, le, mj, a, b);
if(b > mj)
Query(2 * node + 1, mj + 1, ri,a, b);
}
int main()
{
fin >> n >> m;
for ( int i = 1; i <= n; ++i)
{
fin >> A[i];
Update(1,1,n,i,A[i]);
}
int j,x;
for ( int i = 1; i <= m; ++i)
{
fin >> t >> j >> x;
if ( t == 0)
{
A[j] -= x;
Update(1,1,n,j,A[j]);
}
else
{
s = 0;
Query(1,1,n,j,x);
fout << s << "\n";
}
}
}