#include <fstream>
using namespace std;
ifstream cin ("datorii.in");
ofstream cout ("datorii.out");
const int nmax = 15e3;
int n, m, x;
int tip, a, b;
int arbint[1 + 4 * nmax];
void update(int nod, int st, int dr, int index, int value) {
if(st == dr) {
arbint[nod] += value;
return;
}
int mid = (st + dr) / 2;
if(index <= mid)
update(2 * nod, st, mid, index, value);
else
update(2 * nod + 1, mid + 1, dr, index, value);
arbint[nod] = arbint[2 * nod] + arbint[2 * nod + 1];
}
int query(int nod, int st, int dr, int l, int r) {
if(l <= st && dr <= r)
return arbint[nod];
int mid = (st + dr) / 2, nod_st = 0, nod_dr = 0;
if(l <= mid)
nod_st = query(2 * nod, st, mid, l, r);
if(mid < r)
nod_dr = query(2 * nod + 1, mid + 1, dr, l, r);
return nod_st + nod_dr;
}
int main() {
cin >> n >> m;
for(int i = 1; i <= n; i++) {
cin >> x;
update(1, 1, n, i, x);
}
for(int i = 1; i <= m; i++) {
cin >> tip >> a >> b;
if(tip == 0)
update(1, 1, n, a, -b);
else
cout << query(1, 1, n, a, b) << "\n";
}
return 0;
}