#include <iostream>
#include <fstream>
#include <bitset>
#include <deque>
#include <bits/stdc++.h>
#define dim 1005
using namespace std;
string nume="datorii";
ifstream fin(nume+".in");
ofstream fout(nume+".out");
int aib[dim],m,n,i,x,tip,a,b;
void update(int poz,int val){
for(;poz<=n;poz+=poz&-poz){
aib[poz]+=val;
}
}
int query(int poz){
int rez=0;
for(;poz>0;poz-=poz&-poz){
rez+=aib[poz];
}
}
int main(){
fin>>n>>m;
for(i=1;i<=n;i++){
fin>>x;
update(i,x);
}
for(i=1;i<=m;i++){
fin>>tip;
if(tip==0){
fin>>a>>b;
update (a,-b);
}
else{
fin>>a>>b;
fout<<query(b)-query(a-1);
}
}
}