#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
const int mod = 1000000007;

int n;
ll t[500005];

void inc(int x, ll v) {
    for (; x <= n; x += x & -x) t[x] += v;
}

ll que(int x) {
    ll z = 0;
    for (; x; x -= x & -x) z += t[x];
    return z;
}

int main() {
    ios::sync_with_stdio(false);
    int q, o, u, v;
    cin >> n >> q;
    for (int i = 1; i <= n; i++) cin >> u, inc(i, u);
    while (q--) {
        cin >> o >> u >> v;
        if (o == 0) inc(u + 1, v);
        else cout << que(v) - que(u) << '\n';
    }
}

#include <bits/stdc++.h>
#include <atcoder/all>
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define REPLL(i, n) for (ll i = 0; i < (ll)(n); i++)
using namespace std;
using namespace atcoder;
template<class T>inline bool chmax(T &a, const T &b){if(a < b){a = b; return 1;}return 0;}
template<class T>inline bool chmin(T &a, const T &b){if(a > b){a = b; return 1;}return 0;}
typedef long long ll;

int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  int N, Q; cin >> N >> Q;
  fenwick_tree<ll> ft(N);
  REP(i, N){
    ll a; cin >> a;
    ft.add(i, a);
  }
  REP(i, Q){
    int q; cin >> q;
    if(q == 0){
      int p; ll x; cin >> p >> x;
      ft.add(p, x);
    }else{
      int l, r; cin >> l >> r;
      ll ans = ft.sum(l, r);
      cout << ans << endl;
    }
  }
}