#include<cstdio>
#include<iostream>
#include<algorithm>
using namespace std;
#define maxn 15001
#define maxarb ( 1 << 14 )
int n, m ;
int v[maxn] ;
int arbore[maxarb] ;
int query(int st, int dr, int nod, int stn, int drn )
{
if( stn > dr || drn < st )
return 0 ;
if( stn >= st && drn <= dr )
return arbore[nod] ;
return query( st, dr, 2 * nod, stn, ( stn + drn ) / 2 ) + query( st, dr, 2 * nod + 1, ( stn + drn ) / 2 + 1, drn ) ;
}
void modifica(int value, int poz, int nod, int st, int dr)
{
if( poz > dr || poz < st) return ;
if( st == dr)
{
arbore[nod] = value;
return ;
}
modifica( value, poz, nod * 2, st, ( dr + st ) / 2 ) ;
modifica( value, poz, nod * 2 + 1, ( st + dr ) / 2 + 1, dr ) ;
arbore[ nod ] = arbore[nod * 2] + arbore[ nod * 2 + 1 ] ;
}
int main()
{
freopen("datorii.in", "r", stdin);
freopen("datorii.out", "w", stdout);
scanf("%d%d", &n, &m);
for(int i = 1; i <= n; ++i )
{
scanf("%d", &v[i]);
modifica( v[i], i, 1, 1, n ) ;
}
for(int i = 1; i <= m; ++i )
{
int cod, a, b ;
scanf("%d%d%d", &cod, &a, &b);
if( cod == 0 )
modifica( v[a] - b, a, 1, 1, n ) ;
if( cod == 1 )
printf("%d\n", query( a, b, 1, 1, n ));
}
return 0;
}