#include<bits/stdc++.h> usingnamespacestd; constint N = 5e5 + 5; int t[N], op, x, y, n, m; voidadd(int x, int k){ for (; x <= n; x += x & -x) t[x] += k; } intask(int x){ intres(0); for (; x; x -= x & -x) res += t[x]; return res; } intmain(){ ios::sync_with_stdio(0); cin >> n >> m; for (int i = 1; i <= n; i++) cin >> x, add(i, x); for (int i = 1; i <= m; i++) { cin >> op >> x >> y; if (op == 1) add(x, y); else cout << ask(y) - ask(x - 1) << '\n'; } return0; }