#include <iostream>
#include <vector>
using namespace std;
typedef vector<int> vi;
typedef const int ci;
int v[60020];
void add(ci& nod, ci& left, ci& right, ci& poz, ci& val){
if (left == right){
v[nod] += val;
return;
}
int mij = (left + right) / 2;
if (poz <= mij)
add(2 * nod, left, mij, poz, val);
else
add(2 * nod + 1, mij + 1, right, poz, val);
v[nod] = v[2 * nod] + v[2 * nod + 1];
}
int sum(ci& nod, ci& left, ci& right, ci& a, ci& b){
if (left >= a and right <= b)
return v[nod];
int mij = (left + right) / 2;
int s = 0;
if (a <= mij)
s = sum(2 * nod, left, mij, a, b);
if (mij < b)
s += sum(2 * nod + 1, mij + 1, right, a, b);
return s;
}
int main(int argc, const char * argv[]) {
freopen("datorii.in", "r", stdin);
freopen("datorii.out", "w", stdout);
int n, m;
scanf("%d %d", &n, &m);
int x;
for (int i = 1; i <= m; i++) {
scanf("%d", &x);
add(1, 1, n, i, x);
}
int a, b;
while (m--){
scanf("%d %d %d", &x, &a, &b);
if (x)
cout << sum(1, 1, n, a, b) << '\n';
else
add(1, 1, n, a, -b);
}
return 0;
}