#include <bits/stdc++.h>
using namespace std;
ifstream fin("datorii.in");
ofstream fout("datorii.out");
#define lsb(i) (i & (-i))
const int NMAX = 15001;
int n, q, arr[NMAX];
class FenwickTree
{
private:
int tree[NMAX];
public:
void update(int x, int val)
{
for(int i = x; i <= n; i += lsb(i))
tree[i] += val;
}
int query(int x)
{
int sum = 0;
for(int i = x; i > 0; i -= lsb(i))
sum += tree[i];
return sum;
}
};
FenwickTree aib;
int main()
{
fin >> n >> q;
for(int i = 1; i <= n; i++)
{
fin >> arr[i];
aib.update(i, arr[i]);
}
while(q--)
{
int tip;
fin >> tip;
if(tip == 0)
{
int x, val;
fin >> x >> val;
aib.update(x, -val);
}
else
{
int st, dr;
fin >> st >> dr;
fout << aib.query(dr) - aib.query(st - 1) << "\n";
}
}
fin.close();
fout.close();
return 0;
}