#include <iostream>
#include <fstream>
#include <algorithm>
using namespace std;
ifstream fin("datorii.in");
ofstream fout("datorii.out");
const int N = 15e3;
int n, m;
int v[N + 5], arbore[4 * N + 5];
void build(int nod, int st, int dr) {
if (st == dr) {
arbore[nod] = v[st];
return;
}
int m = (st + dr) / 2;
build(2 * nod, st, m);
build(2 * nod + 1, m + 1, dr);
arbore[nod] = arbore[2 * nod] + arbore[2 * nod + 1];
}
void update(int nod, int st, int dr, int poz, int val) {
if (st == dr) {
arbore[nod] -= val;
return;
}
int m = (st + dr) / 2;
if (poz <= m)
update(2 * nod, st, m, poz, val);
else
update(2 * nod + 1, m + 1, dr, poz, val);
arbore[nod] = arbore[2 * nod] + arbore[2 * nod + 1];
}
int query (int nod, int st, int dr, int qst, int qdr) {
if (qst == st && dr == qdr)
return arbore[nod];
int m = (st + dr) / 2, suma = 0;
if (qst <= m)
suma += query (2 * nod, st, m, qst, min (m, qdr));
if (qdr > m)
suma += query (2 * nod + 1, m + 1, dr, max(m + 1, qst), qdr);
return suma;
}
int main() {
fin >> n >> m;
for (int i = 1; i <= n; i++)
fin >> v[i];
build (1, 1, n);
for (int i = 1; i <= m; i++) {
int t, a, b;
fin >> t >> a >> b;
if (t == 0)
update (1, 1, n, a, b);
else
fout << query (1, 1, n, a, b) << "\n";
}
return 0;
}