#include <iostream>
#include <fstream>
using namespace std;
int aint[40000];
void update (int node, int st, int dr, int x, int y) {
if (st == dr) aint[node] += y;
else {
int mi = (st + dr) / 2;
if (x <= mi) update(2 * node, st, mi, x, y);
else update(2 * node + 1, mi + 1, dr, x, y);
aint[node] = aint[2 * node] + aint[2 * node + 1];
}
}
int query (int node, int st, int dr, int x, int y ) {
if (x <= st && dr <= y) return aint[node];
else {
int mi = (st + dr) / 2;
int ans1 = 0, ans2 = 0;
if (x <= mi) ans1 = query(2 * node, st, mi, x, y);
if (y > mi) ans2 = query(2 * node + 1, mi + 1, dr, x, y);
return ans1 + ans2;
}
}
int main()
{
ifstream f("datorii.in");
ofstream g("datorii.out");
int n, m, i;
f >> n >> m;
int b, x, y;
for (i = 1; i <= n; ++i) {
f >> x;
update(1, 1, n, i, x);
}
for (i = 1; i <= m; ++i) {
f >> b >> x >> y;
if (b == 0) update(1, 1, n, x, -y);
else g << query(1, 1, n, x, y) << "\n";
}
return 0;
}