#include <bits/stdc++.h>
#define int long long
#define lowbit(x) x & -x
using namespace std;
int n, m, a, op, x, y, tr[500005];
inline void update(int p, int v) {
    while (p <= n) {
        tr[p] += v;
        p += lowbit(p);
    }
}
inline int query(int p) {
    int r = 0;
    while (p > 0) {
        r += tr[p];
        p -= lowbit(p);
    }
    return r;
}
signed main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    cin >> n >> m;
    for (int i = 1; i <= n; i++) {
        cin >> a;
        update(i, a);
    }
    while (m--) {
        cin >> op >> x >> y;
        if (op == 1) {
            update(x, y);
        } else {
            cout << query(y) - query(x - 1) << "\n";
        }
    }
    return 0;
}