#include <iostream>
#include <stdio.h>
using namespace std;
#define MAXN 16384
int aint[4 * MAXN];
void update(int &put, int nrzi, int dif){
int nod = nrzi - 1 + put;
while(1 <= nod){
aint[nod] -= dif;
nod /= 2;
}
}
void query(int &st, int &dr, int &s, int nod, int nodst, int noddr){
if((st <= nodst) && (noddr <= dr)){
s += aint[nod];
}else{
if(st <= (nodst + (noddr - nodst) / 2)){
query(st, dr, s, nod * 2, nodst, nodst + (noddr - nodst) / 2);
}
if((nodst + (noddr - nodst) / 2 + 1) <= dr){
query(st, dr, s, nod * 2 + 1, nodst + (noddr - nodst) / 2 + 1, noddr);
}
}
}
int main()
{
FILE *fin, *fout;
int n, m, i, put, op, a, b, s, j;
fin = fopen("datorii.in", "r");
fscanf(fin, "%d%d", &n, &m);
for(put = 1; put <= n; put *= 2);
for(i = 0; i < n; i++){
fscanf(fin, "%d", &aint[put + i]);
}
///crearea arborelui de intervale
put *= 2;
for(i = put / 2; i < put; i++){
j = i / 2;
while(1 <= j){
aint[j] += aint[i];
j /= 2;
}
}
put /= 2;
fout = fopen("datorii.out", "w");
for(i = 0; i < m; i++){
fscanf(fin, "%d%d%d", &op, &a, &b);
if(op == 0){
update(put, a, b);
}else{
s = 0;
query(a, b, s, 1, 1, put);
fprintf(fout, "%d\n", s);
}
}
fclose(fin);
fclose(fout);
return 0;
}