#include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using namespace atcoder;

typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vl2;
const bool multiple_queries = false;
#define rep(i, n) for(ll i = 0; i < (n) ; ++i)
#define For(i, a, b) for(ll i = (a); i < (b) ; ++i)
#define revrep(i, n) for(ll i = (n) - 1; i >= 0 ; --i)
#define revFor(i, b, a) for(ll i = (b) - 1; i >= (a) ; --i)
#define all(v) v.begin(), v.end()
#define rall(v) (v).rbegin(), (v).rend()
#define popcount(i) __builtin_popcountl((i))
#define substring(s, start, end) s.substr((start), (end) - (start) + 1)

struct BinaryIndexedTree{
  ll n, ini, M; vl dat;
  BinaryIndexedTree(ll n, ll ini = 0):
    dat(n + 1, ini), n(n), ini(ini){M = 1; while (M <= n) M <<= 1;};

  //       x: 1001 1010  1100 1011 1101  1111
  // x & - x: 0001 0010  0100 0001 0001  0001
  //      ->: 1010 1100 10000 1100 1100 10000

  ll update_func(ll val, ll d){
    // if maximum -> max(val, dat)
    // return max(val, d);
    // if cumulative sum
    return val + d;
  }

  ll query(ll i){
    /*
    v[0] + v[1] + ... + v[i]
    e.g.) i = 10101
    itr1. 10101 -> 10100
    itr2. 10100 -> 10000
    itr3. 10000 -> 00000 (break)
    */

    if (i < 0) return ini;
    ll ret = 0;
    for (ll j = i; j >= 0; j = (j & (j + 1)) - 1){
      ret = update_func(ret, dat[j]);
    }
    return ret;
}

  ll query(ll l, ll r){
    // a[l] + a[l + 1] + ... + a[r - 1] + a[r]
    return query(r) - query(l - 1);
  }

  ll lower_bound(ll key){
    //v[0] + v[1] + ... + v[left - 1] < key <= v[0] + v[1] + ... + v[left]
    if (key <= 0) return 0;
    ll left = 0, right = 1;
    while(right <= n) right <<= 2;

    for (ll i = right; i > 0; i /= 2){
      if (left + i <= n && dat[left + i - 1] < key){
        key -= dat[left + i - 1];
        left += i;
      }
    }
    return left;
  }

  void update(ll i, ll val){
    /*
    e.g.) i = 10101, n = 11111
    itr1. i: 10101, i+1: 10110 -> 10111
    itr2. i: 10111, i+1: 11000 -> 11111 (break)
    */
    if (i < 0) return;
    for(ll j = i; j < n; j |= j + 1){
      dat[j] = update_func(val, dat[j]);
    }
  }
};

template<typename T>
void read_vector(ll n, vector<T>& v, ll offset = 0){
  v.resize(n);
  rep(i, n){
    cin >> v[i];
    if (offset) v[i] += offset;
  }
}

void solve(){
  ll n, Q;
  cin >> n >> Q;
  vl as;
  read_vector(n, as);
  // BinaryIndexedTree bit(n);
  fenwick_tree<ll> bit(n);
  rep(i, n) bit.add(i, as[i]);
  rep(i, Q){
    ll mode; cin >> mode;
    if (mode){
      ll l, r; cin >> l >> r;
      cout << bit.sum(l, r) << endl;
    }else{
      ll p, x; cin >> p >> x;
      bit.add(p, x);
    }
  }
}

void test(ll num = 0, bool verbose = false){
  rep(i, max(1LL, num)){
    ll t = clock();
    if (verbose) cout << "\n#####" << " " << i + 1 << " " << "#####" << " " << "\n## Answer ##\n";
    solve();
    if (verbose) {cout << "\nElapsed Time:" << " " << 1000.0 * (clock() - t) / CLOCKS_PER_SEC << " " << "[ms]" << endl;}
  }
}

int main(void){
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  #ifdef _LOCAL
    test(6, true);
  #else
    ll t = 0;
    if (multiple_queries) cin >> t;
    test(t, false);
  #endif
  return 0;
}

Measured memory_bytes: 12160