#include <stdio.h>
int n,m,arbore[50000],L,R;
int contor = 1;
void add( long poz,long st,long dr,long unde,long cat)
{
if( unde > dr || unde < st)
return; // nu ne intersectam
if ( st == dr)
{
arbore[poz] += cat;
return ;
}
add( poz *2, st , (st+dr)/2, unde,cat);
add( poz *2+1, (st + dr)/2+1,dr,unde,cat);
/* pentru maxim
arbore[poz] = max( arbore[poz*2],arbore[poz*2+1]);
*/
arbore[poz] += cat;
/* pentru suma
arbore[poz] = sum(........)
arbore[poz] += cat; // oricare din ele
*/
}
// poz = pozitia in arbore, st,dr limitele intervalului poz, L R limitele de insumare
long suma( long poz,long st,long dr)
{
if( dr < L || st > R)//incluziune ciuciu
return 0;
if( L <= st && dr <= R)// incluziune totala
{
return arbore[poz];
}
return suma(poz*2, st , (st+dr)/2 ) + suma( poz*2+1 , (st+dr)/2+1, dr);
}
int main ()
{
freopen("datorii.in","r",stdin);
freopen("datorii.out","w",stdout);
scanf("%d %d",&n,&m);
for (int i = 1;i <= n;i ++)
{
int x;
scanf("%d",&x);
add(1,1,n,i,x);//1 pozitia in arbore ; 1 -n intervalul; i pozitia modificata; noua valoare
}
//build_arbore(1,n,1,0);
for (int i = 1;i <= m; i++)
{
long x,y,z;
scanf("%ld %ld %ld",&x,&y,&z);
if( x == 0)
{
add(1,1,n,y,-z);
}
if( x == 1)
{
L = y;
R = z;
printf("%ld\n",suma(1,1,n));
}
}
return 0;
}