#include <iostream>
#include <fstream>
using namespace std;
int n[60100], v[15005];
void creare(int pos, int left, int right)
{
if(left == right)
{
n[pos] = v[left];
return;
}
creare(pos*2, left, (left+right)/2);
creare(pos*2+1, (left+right)/2+1, right);
n[pos] = n[pos*2]+n[pos*2+1];
}
void achitat(int pos, int left, int right, int i, int x)
{
if(i < left || i > right)
return;
if(left == right)
{
n[pos] -= x;
return;
}
int mid = (left+right)/2;
if(i <= mid)
achitat(pos*2, left, mid, i, x);
else
achitat(pos*2+1, mid+1, right, i, x);
n[pos] = n[pos*2]+n[pos*2+1];
}
int sum(int pos, int left, int right, int i, int j)
{
if(right < i || left > j)
return 0;
if(i <= left && j >= right)
return n[pos];
int mid = (left+right)/2;
return sum(pos*2, left, mid, i, j) + sum(pos*2+1, mid+1, right, i, j);
}
int main()
{
ifstream fin ("datorii.in");
ofstream fout("datorii.out");
int n, m, i, op, x, pos;
fin>>n>>m;
for(i = 1; i <= n; i++)
fin>>v[i];
creare(1, 1, n);
while(m)
{
fin>>op>>pos>>x;
if(op == 0)
achitat(1, 1, n, pos, x);
if(op == 1)
fout<<sum(1, 1, n, pos, x)<<'\n';
m--;
}
return 0;
}