#include <iostream>
#include <fstream>
#include <vector>
#include <cmath>
using namespace std;
ifstream fin("datorii.in");
ofstream fout("datorii.out");
int arbint[60006], n, m;
void add_value(int node_poz, int left, int right, int poz, int x)
{
if(left == right)
arbint[node_poz] = x;
else
{
int m = (left+right) >> 1;
if(poz <= m)
add_value((node_poz<<1), left, m, poz, x);
else add_value((node_poz<<1) + 1, m+1, right, poz, x);
arbint[node_poz] = arbint[(node_poz<<1)] + arbint[(node_poz<<1) + 1];
}
}
void change_value(int node_poz, int left, int right, int poz, int x)
{
if(left == right)
arbint[node_poz] -= x;
else
{
int m = (left+right) >> 1;
if(poz <= m)
change_value((node_poz<<1), left, m, poz, x);
else change_value((node_poz<<1) + 1, m+1, right, poz, x);
arbint[node_poz] = arbint[(node_poz<<1)] + arbint[(node_poz<<1) + 1];
}
}
int find_sum(int node_poz, int left, int right, int a, int b)
{
if(a <= left && right <= b)
return arbint[node_poz];
else
{
int m = (left+right) >> 1;
int son1 = 0;
int son2 = 0;
if(a <= m)
son1 = find_sum((node_poz<<1), left, m, a, b);
if(b > m)
son2 = find_sum((node_poz<<1)+1, m+1, right, a, b);
return son1 + son2;
}
}
int main()
{
int a, b, x, op;
fin >> n >> m;
for(int i = 1; i <= n; i++)
{
fin >> x;
add_value(1, 1, n, i, x);
}
for(int i = 1; i <= m; i++)
{
fin >> op >> a >> b;
if(op == 1)
fout << find_sum(1, 1, n, a, b) << '\n';
else change_value(1, 1, n, a, b);
}
}