#include <iostream>
#include <fstream>
using namespace std;
ifstream fin("datorii.in");
ofstream fout("datorii.out");
const int NMAX = 15003;
int aint[4 * NMAX], n, q;
void update(int nod, int st, int dr, int pos, int val) {
if (st == dr) {
aint[nod] -= val;
return;
}
int mid = (st + dr) / 2;
if (pos <= mid) {
update(2 * nod, st, mid, pos, val);
} else {
update(2 * nod + 1, mid + 1, dr, pos, val);
}
aint[nod] = aint[2 * nod] + aint[2 * nod + 1];
}
int query(int nod, int st, int dr, int a, int b) {
if (a <= st && dr <= b) {
return aint[nod];
}
int mid = (st + dr) / 2;
int res = 0;
if (a <= mid) {
res += query(2 * nod, st, mid, a, b);
}
if (mid < b) {
res += query(2 * nod + 1, mid + 1, dr, a, b);
}
return res;
}
int main() {
fin >> n >> q;
for (int i = 1; i <= n; i++) {
int x;
fin >> x;
update(1, 1, n, i, -x);
}
while (q--) {
int tip, a, b;
fin >> tip >> a >> b;
if (tip == 0) {
update(1, 1, n, a, b);
} else {
fout << query(1, 1, n, a, b) << '\n';
}
}
return 0;
}