#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#define NX 65536
int N, M, A[NX], K, VAL, LEFTINT, RIGHTINT;
void create(int l, int r, int originalPos, int currentPos)
{
if (l == r)
{
if (K == 1) {
A[currentPos] = VAL;
} else {
A[currentPos] -= VAL;
}
}
else
{
int mij = (l + r) >> 1;
if (originalPos <= mij)
{
create(l, mij, originalPos, currentPos << 1);
}
else
{
create(mij + 1, r, originalPos, (currentPos << 1) + 1);
}
A[currentPos] = A[currentPos << 1] + A[(currentPos << 1) + 1];
}
}
int query(int left, int right, int currentPos)
{
if (LEFTINT <= left && RIGHTINT >= right)
{
return A[currentPos];
}
else
{
int mij = (left + right) >> 1, leftRes = 0, rightRes = 0;
if (LEFTINT <= mij) {
leftRes = query(left, mij, currentPos << 1);
}
if (RIGHTINT > mij) {
rightRes = query(mij + 1, right, (currentPos << 1) + 1);
}
return leftRes + rightRes;
}
}
int main()
{
freopen("datorii.in", "r", stdin);
freopen("datorii.out", "w", stdout);
scanf("%d %d", &N, &M);
K = 1;
int elem = 0;
for (int i = 1; i <= N; i++)
{
scanf("%d", &elem);
VAL = elem;
create(1, N, i, 1);
}
K = 0;
int cod = 0, a = 0, b = 0;
for (int i = 1; i <= M; i++)
{
scanf("%d %d %d", &cod, &a, &b);
switch (cod)
{
case 0:
VAL = b;
create(1, N, a, 1);
break;
case 1:
LEFTINT = a;
RIGHTINT = b;
printf("%d\n", query(1, N, 1));
break;
}
}
}