#include <fstream>
#include <cmath>
using namespace std;
void update(int index, int val, int pos, int left, int right, int A[], int tree[])
{
if (left == right && pos == left)
tree[index] += val;
else if (pos >= left && pos <= right)
{
update(index * 2 + 1, val, pos, left, (left + right) / 2, A, tree);
update(index * 2 + 2, val, pos, (left + right) / 2 + 1, right, A, tree);
tree[index] += val;
}
}
int query(int index, int left, int right, int cLeft, int cRight, int A[], int tree[])
{
if (left <= cLeft && right >= cRight)
return tree[index];
if (cLeft > right || cRight < left)
return 0;
int leftSum = query(index * 2 + 1, left, right, cLeft, (cLeft + cRight) / 2, A, tree);
int rightSum = query(index * 2 + 2, left, right, (cLeft + cRight) / 2 + 1, cRight, A, tree);
return leftSum + rightSum;
}
int main()
{
int i, N, M;
ifstream f("datorii.in");
f >> N >> M;
int A[N], length = (1 << ((int)log2(N) + 2)) - 1;
int tree[length];
fill(tree, tree + length, 0);
for (i = 0; i < N; i++)
{
f >> A[i];
update(0, A[i], i, 0, N - 1, A, tree);
}
int op, x, y;
ofstream g("datorii.out");
for (i = 0 ; i < M; i++)
{
f >> op >> x >> y;
if (op == 0)
update(0, -y, x - 1, 0, N - 1, A, tree);
else if (op == 1)
g << query(0, x - 1, y - 1, 0, N - 1, A, tree) << '\n';
}
f.close();
g.close();
return 0;
}