#include <bits/stdc++.h>
using namespace std;
ifstream fin ("datorii.in");
ofstream fout("datorii.out");
int lsb(int x)
{
return x & (-x);
}
struct AIB
{
vector<long long int> aib;
AIB(int n)
{
aib.resize(n + 9);
}
long long int query(int x)
{
long long int sum = 0;
for(int i = x; i > 0; i -= lsb(i))
sum += aib[i];
return sum;
}
void update(int x, int add)
{
for(int i = x; i < aib.size(); i += lsb(i))
aib[i] += add;
}
};
int main()
{
int n, m;
fin >> n >> m;
AIB aib(n);
vector<int> arr(n + 9);
for(int i = 1; i <= n; i++)
{
fin >> arr[i];
aib.update(i, arr[i]);
}
for(int i = 1; i <= m; i++)
{
int op, x, y;
fin >> op >> x >> y;
if(op == 1)
{
fout << aib.query(y) - aib.query(x - 1) << '\n';
}
else
{
aib.update(x, -y);
}
}
return 0;
}