#include <bits/stdc++.h>
using namespace std;
int n,m,a[500001];
long long ans;
int lowbit(int x){
return x & (-x);
}
void add(int x,int k){
for(int i=x; i<=n; i+=lowbit(i))
a[i] += k;
}
void sum(int l,int r){
for(int i=r; i>0; i-=lowbit(i))
ans += a[i];
for(int i=l-1; i>0; i-=lowbit(i))
ans -= a[i];
}
int main(){
cin >> n >> m;
for(int i=0; i<n; i++){
int t; cin >> t;
add(i,t);
}
for(int i=1; i<=m; i++){
int op,x,y;
cin >> op >> x >> y;
if(op == 1) add(x,y);
else {
ans = 0;
sum(x,y);
cout << ans << "\n";
}
}
return 0;
}