#include <fstream>
using namespace std;
ifstream fin("datorii.in");
ofstream fout("datorii.out");
int N, M, AIB[15002];
void update(int pos, int val)
{
for (; pos <= N; pos += pos & -pos)
AIB[pos] += val;
}
int query(int pos)
{
int sum = 0;
for (; pos >= 1; pos -= pos & -pos)
sum += AIB[pos];
return sum;
}
int main()
{
fin >> N >> M;
for (int i = 1, x; i <= N; ++i)
{
fin >> x;
update(i, x);
}
int type, a, b;
for (int i = 1; i <= M; ++i)
{
fin >> type >> a >> b;
if (type == 0)
update(a, -b);
else
fout << query(b) - query(a - 1) << '\n';
}
fin.close();
fout.close();
return 0;
}