#include <fstream>
#include <vector>
#include <bitset>
#include <queue>
#include <algorithm>
#include <utility>
#include <cstring>
#include <string>
#include <stack>
#include <deque>
#include <iomanip>
#include <set>
#include <map>
#include <cassert>
#include <ctime>
#include <list>
#include <iomanip>
using namespace std;
string file = "datorii";
ifstream cin( (file + ".in").c_str() );
ofstream cout( (file + ".out").c_str() );
const int MAXN = 15005;
const int oo = (1<<31)-1;
typedef vector<int> Graph[MAXN];
typedef vector<int> :: iterator It;
const inline int min(const int &a, const int &b) { if( a > b ) return b; return a; }
const inline int max(const int &a, const int &b) { if( a < b ) return b; return a; }
const inline void Get_min(int &a, const int b) { if( a > b ) a = b; }
const inline void Get_max(int &a, const int b) { if( a < b ) a = b; }
struct ClassComp {
inline bool operator () (const int &a, const int &b) const {
return a > b;
}
};
int A[MAXN * 3];
int N, M;
inline void Update(int Node, int st, int dr, int pos, int val) {
if(st == dr) {
A[Node] += val;
return;
}
int mid = ((st + dr) >> 1);
if(pos <= mid)
Update((Node << 1), st, mid, pos, val);
else
Update((Node << 1) + 1, mid + 1, dr, pos, val);
A[Node] = A[(Node << 1)] + A[(Node << 1) + 1];
}
inline int Query(int Node, int st, int dr, int a, int b) {
if(a <= st && dr <= b)
return A[Node];
int mid = ((st + dr) >> 1);
int ret = 0;
if(a <= mid)
ret += Query((Node << 1), st, mid, a, b);
if(mid < b)
ret += Query((Node << 1) + 1, mid+1, dr, a, b);
return ret;
}
int main() {
cin >> N >> M;
for(int i = 1 ; i <= N ; ++ i) {
int x;
cin >> x;
Update(1, 1, N, i, x);
}
for(int i = 1 ; i <= M ; ++ i) {
int x, y;
bool op;
cin >> op >> x >> y;
if(!op)
Update(1, 1, N, x, -y);
else {
cout << Query(1, 1, N, x, y) << '\n';
}
}
cin.close();
cout.close();
return 0;
}