#include <fstream>
#include <algorithm>
using namespace std;
ifstream cin("datorii.in");
ofstream cout("datorii.out");
#define NMAX 15001
int arbore[NMAX * 4], i, n, x, tip, y, m;
static inline void update(int a, int b, int nod, int poz, int val) {
if(a == b)
arbore[nod] = val;
else {
int mid = (a + b) / 2;
if(poz <= mid)
update(a, mid, nod * 2, poz, val);
else update(mid + 1, b, nod * 2 + 1, poz, val);
arbore[nod] += val;
}
}
static inline int suma(int a, int b, int nod, int st, int dr) {
int s = 0;
if(st <= a && b <= dr)
return arbore[nod];
int mid = (a + b) / 2;
if(st <= mid)
s += suma(a, mid, nod * 2, st, dr);
if(mid < dr)
s += suma(mid + 1, b, nod * 2 + 1, st, dr);
return s;
}
int main() {
cin >> n >> m;
for(i = 1; i <= n; i++) {
cin >> x;
update(1, n, 1, i, x);
}
for(i = 1; i <= m; i++) {
cin >> tip >> x >> y;
if(tip == 1)
cout << suma(1, n, 1, x, y) << '\n';
else update(1, n, 1, x, -y);
}
return 0;
}