#include <bits/stdc++.h>
#define NMAX 45001
using namespace std;
typedef long long ll;
int dx[] = {-1, 0, 1, 0, -1, -1, 1, 1};
int dy[] = {0, 1, 0, -1, -1, 1, 1, -1};
const string file = "datorii";
ifstream fin(file + ".in");
ofstream fout(file + ".out");
int n, m;
int arbore[NMAX];
int position, value, sum;
int start, finish;
void update(int node, int lb, int rb) {
if (lb == rb) {
arbore[node] += value;
return;
}
int mid = (lb + rb) >> 1;
if (position <= mid)
update(2 * node, lb, mid);
else
update(2 * node + 1, mid + 1, rb);
arbore[node] = arbore[2 * node] + arbore[2 * node + 1];
}
void query(int node, int lb, int rb) {
if (start <= lb && rb <= finish) {
sum += arbore[node];
return;
}
int mid = (lb + rb) >> 1;
if (start <= mid)
query(2 * node, lb, mid);
if (mid < finish)
query(2 * node + 1, mid + 1, rb);
}
int main() {
int x, op, a, b;
fin >> n >> m;
for (int i = 1; i <= n; i++) {
fin >> x;
position = i;
value = x;
update(1, 1, n);
}
for (int i = 1; i <= m; i++) {
fin >> op >> a >> b;
if (op == 0) {
value = -b;
position = a;
update(1, 1, n);
} else {
sum = 0;
start = a;
finish = b;
query(1, 1, n);
fout << sum << "\n";
}
}
return 0;
}