#include <fstream>
using namespace std;
const int MAX = 15014;
ifstream fin ("datorii.in");
ofstream fout ("datorii.out");
int ARB[MAX << 2],VAL,OP;
void create(int pos, int st, int dr, int initpos)
{
if (st == dr) {
if (OP == 1 )
ARB[pos] = VAL;
else
ARB[pos] -= VAL;
return;
}
int mij = (st + dr) >> 1;
if (initpos <= mij)
create(pos << 1, st, mij, initpos);
else
create(pos << 1 | 1, mij + 1, dr, initpos);
ARB[pos] = ARB[pos << 1] + ARB[pos << 1 | 1];
}
int Query(int pos, int st, int dr, int x, int y)
{
if(x <= st and dr <= y)
return ARB[pos];
int mij =(st + dr) >> 1, SOL = 0;
if(x <= mij)
SOL = SOL + Query(pos << 1, st, mij, x, y);
if(y > mij)
SOL = SOL + Query(pos << 1 | 1, mij + 1, dr, x, y);
return SOL;
}
int main(int argc, char *argv[])
{
int n, m;
fin >> n >> m;
OP = 1;
for(int i = 1; i <= n; ++i) {
fin >> VAL;
create(1, 1, n, i);
}
OP = 0;
for (; m; -- m) {
int nr, x, y;
fin >> nr;
if(nr == 0) {
fin >> x >> y;
VAL = y;
create(1, 1, n, x);
} else {
fin >> x >> y;
fout << Query(1, 1, n, x, y) << '\n';
}
}
return 0;
}