#include<fstream>
#include<cmath>
using namespace std;
ifstream cin("datorii.in");
ofstream cout("datorii.out");
const int NMAX = 15e3 + 20;
const int BMAX = ceil(sqrt(NMAX));
long long mars[BMAX + 10];
int v[NMAX],block,ap[NMAX];
long long query(int pref)
{
long long ans = 0; if(!pref) return 0;
for(int i = 1; i < ap[pref] ; i++) ans += mars[i];
for(int i = pref; ap[i] == ap[pref] ; i--) ans += v[i];
return ans;
}
int main()
{
int n,q,a,b,c; cin >> n >> q; block = max(2,(int)ceil(sqrt(n)));
for(int i = 1; i <= n ; i++)
{
ap[i] = ap[i - 1];
if(i % block == 1) ap[i]++;
cin >> v[i]; mars[ap[i]] += v[i];
}
while(q--)
{
cin >> a >> b >> c;
if(a == 0)
{
mars[ap[b]] -= c;
v[b] -= c;
}
else if(a == 1)
{
if(b > c) swap(c,b);
cout << query(c) - query(b - 1) << '\n';
}
}
}