#include <cstdio>
#include <cstring>
#include <iostream>
#include <vector>
#include <algorithm>
#include <set>
#include <stack>
#include <queue>
#include <list>
//#include <windows.h>
//#include <conio.h>
#include <cstdlib>
#include <time.h>
#include <limits.h>
#include <string>
#include <math.h>
using namespace std;
#define forA(V,it) for (typeof(V.begin()) it=V.begin();it!=V.end();it++)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define ll long long
#define ull unsigned ll
#define MOD 1000000007
#define INF (1<<31)-1
#define MINF -(1<<31)
#define vi vector <int>
#define vll vector <ll>
#define pii pair <int,int>
#define pll pair <ll,ll>
#define newl printf("\n")
#define DIM 15005
int N,M,x,AINT[(DIM<<2)+66],i,sum;
void update(int nod,int st,int dr,int poz,int val)
{
if (st==dr)
{
AINT[nod]+=val;
return;
}
int mid=(st+dr)>>1;
if (poz<=mid) update(nod<<1,st,mid,poz,val);
else update((nod<<1)+1,mid+1,dr,poz,val);
AINT[nod]=AINT[nod<<1]+AINT[(nod<<1)+1];
}
void query(int nod,int st,int dr,int a,int b)
{
if (a<=st && dr<=b)
{
sum+=AINT[nod];
return;
}
int mid=(st+dr)>>1;
if (a<=mid) query(nod<<1,st,mid,a,b);
if (mid<b) query((nod<<1)+1,mid+1,dr,a,b);
}
int main()
{
freopen("datorii.in","r",stdin);
freopen("datorii.out","w",stdout);
scanf("%d %d",&N,&M);
for (i=1;i<=N;i++)
{
scanf("%d",&x);
update(1,1,N,i,x);
}
while (M--)
{
int op,a,b;
scanf("%d %d %d",&op,&a,&b);
if (op==0) update(1,1,N,a,-b);
else
{
sum=0;
query(1,1,N,a,b);
printf("%d\n",sum);
}
}
return 0;
}