#include<bits/stdc++.h>
using namespace std;
const int N=5e5+10;
int n,m;
int a[N];
int c[N<<2];
int lowbit(int x){
return x&-x;
}
void updata(int x,int k){
while(x<=n){
c[x]+=k;
x+=lowbit(x);
}
}
int getsum(int x){
int ans=0;
while(x){
ans+=c[x];
x-=lowbit(x);
}
return ans;
}
int main(){
scanf("%d%d",&n,&m);
for(int i=1;i<=n;i++){
scanf("%d",&a[i]);
updata(i,a[i]);
}
for(int i=1;i<=m;i++){
int go;
scanf("%d",&go);
if(go==1){
int x,y;
scanf("%d%d",&x,&y);
updata(x,y);
}
if(go==2){
int x,y;
scanf("%d%d",&x,&y);
printf("%d
",getsum(y)-getsum(x-1));
}
}
return 0;
}