#include <stdio.h>
#define DIMENSIUNE_ARBORE 32769
int A[DIMENSIUNE_ARBORE], n, m;
void update(int nod, int li, int ls, int poz, int val)
{
A[nod] += val;
if(li == ls) return;
int m = (li + ls) / 2;
if(poz <= m) update(2 * nod, li, m, poz, val);
else update(2 * nod + 1, m + 1, ls, poz, val);
}
int querry(int nod, int li, int ls, int a, int b)
{
if(a <= li && ls <= b) return A[nod];
else
{
int m = (li + ls) / 2;
int si1 = 0, si2 = 0;
if(a <= m) si1 = querry(2 * nod, li, m, a, b);
if(b > m) si2 = querry(2 * nod + 1, m + 1, ls, a, b);
return si1 + si2;
}
}
int main()
{
int i, op, x, y;
freopen("datorii.in", "r", stdin);
freopen("datorii.out", "w", stdout);
scanf("%d%d", &n, &m);
for(i = 1; i <= n; ++i)
{
scanf("%d", &x);
update(1, 1, n, i, +x);
}
while(m--)
{
scanf("%d%d%d", &op, &x, &y);
if(op == 0) update(1, 1, n, x, -y);
else printf("%d\n", querry(1, 1, n, x, y));
}
return 0;
}