#include<bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define rep(i,a,b) for(int i = a; i <= b; i ++)
const int N = 5e5 + 10;
int a[N];
int n, m;
struct BIT{
int len;
int e[N];
BIT(int n) {
len = n;
}
int lowbit(int x) {
return x & (-x);
}
void add(int x, int v) { // 单点修改
while (x <= len) {
e[x] += v;
x += lowbit(x);
}
}
int sum(int x) { // 前缀和
int ans = 0;
while (x) {
ans += e[x];
x -= lowbit(x);
}
return ans;
}
};
int main() {
IOS;
cin >> n >> m;
BIT tre(n);
rep(i, 1, n) {
cin >> a[i];
tre.add(i, a[i]);
}
while (m --) {
int a, b, c; cin >> a >> b >> c;
if (a == 1) tre.add(b, c);
else cout << tre.sum(c) - tre.sum(b - 1) << "\n";
}
return 0;
}