#include <cstdio>
#define NMAX 60066
#define buffSize 8192
int N, M, arb[NMAX], sum;
FILE *f = fopen("datorii.in", "r");
char str[buffSize];
void update(int node, int left, int right, const int &pos, const int &val);
//void init(int node, int left, int right, const int &pos, const int &val);
void query(int node, int left, int right, const int &A, const int &B);
inline void readInt(int &val)
{
static int pos = 0, len = 0;
val = 0;
if (pos == len)
{
len = fread(str, sizeof(char), buffSize, f);
pos = 0;
}
while (pos < len && (str[pos] > '9' || str[pos] < '0'))
{
++pos;
if (pos == len)
{
len = fread(str, sizeof(char), buffSize, f);
pos = 0;
}
}
while (pos < len && (str[pos] <= '9' && str[pos] >= '0'))
{
val = val * 10 + str[pos] - '0';
pos++;
if (pos == len)
{
len = fread(str, sizeof(char), buffSize, f);
pos = 0;
}
}
}
int main()
{
int tmp, type, val;
freopen("datorii.out","w",stdout);
readInt(N);readInt(M);
for (int i = 1 ;i <= N ; ++i)
{
//scanf("%d", &tmp);
readInt(tmp);
tmp = -tmp;
update(1, 1, N, i, tmp);
}
for (;M;--M)
{
//scanf("%d %d %d", &type, &tmp, &val);
readInt(type);readInt(tmp);readInt(val);
if (type)
{
sum = 0;
query(1, 1, N, tmp, val);
printf("%d\n", sum);
}
else
update(1, 1, N, tmp, val);
}
return 0;
}
void update(int node, int left, int right, const int &pos, const int &val)
{
if (left >= right)
{
arb[node] -= val;
return;
}
int mid = (left + right) >> 1;
if (pos <= mid) update(node << 1, left, mid, pos, val);
else update((node << 1) | 1, mid + 1, right, pos, val);
arb[node] -= val;
}
void query(int node, int left, int right, const int &A, const int &B)
{
if (left >= A && right <= B)
{
sum += arb[node];
return;
}
int mid = (left + right) >> 1;
if (A <= mid) query(node << 1, left, mid, A, B);
if (B > mid) query((node << 1) | 1, mid + 1, right, A, B);
}