/*
"TLE is like the wind, always by my side"
- Yasuo - 2022 -
*/
#include <bits/stdc++.h>
#define debug(x) cerr << #x << " " << x << "\n"
#define debugs(x) cerr << #x << " " << x << " "
#pragma GCC optimize("Ofast")
using namespace std;
int sp[15001];
int aib[15001];
int n,m,i,j,x,a,b,ans,type;
void update(int index, int delta)
{
while (index<=n)
{
aib[index]-=delta;
index+=index&(-index);
}
}
int query(int index)
{
ans=sp[index];
while (index>0)
{
ans+=aib[index];
index-=index&(-index);
}
return ans;
}
int main()
{
ifstream fin("datorii.in");
ofstream fout("datorii.out");
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
fin >> n >> m;
for (i=1;i<=n;i++)
{
fin >> x;
sp[i]=sp[i-1]+x;
}
for (i=1;i<=m;i++)
{
fin >> type >> a >> b;
if (type==0)
{
update(a,b);
}
if (type==1)
{
fout << query(b)-query(a-1) << "\n";
}
}
}