#include<cstdio>
#include<algorithm>
#define lid (id*2)
#define rid (id*2+1)
using namespace std;
struct s_tree
{
int l,r;
int mx,sum;
}tr[100005*4];
int a[100005],n,ans[100005],m,v;
void build(int id,int l,int r)
{
tr[id].l=l;
tr[id].r=r;
if(tr[id].l==tr[id].r)
{
tr[id].sum=a[l];
tr[id].mx=a[l];
return;
}
int mid=(l+r)/2;
build(lid,l,mid);
build(rid,mid+1,r);
tr[id].sum=tr[rid].sum+tr[lid].sum;
tr[id].mx=max(tr[lid].mx,tr[rid].mx);
}
void modity(int id,int x,int val)
{
if(tr[id].l==tr[id].r)
{
tr[id].mx=val;
tr[id].sum=val;
return;
}
int mid=(tr[id].l+tr[id].r)/2;
modity(x<=mid?lid:rid,x,val);
tr[id].sum=tr[lid].sum+tr[rid].sum;
tr[id].mx=max(tr[lid].mx,tr[rid].mx);
}
int quety(int id,int l,int r)
{
if(tr[id].l==l&&tr[id].r==r)
{
return tr[id].sum;
}
int mid=(tr[id].l+tr[id].r)/2;
if(l>mid)return quety(rid,l,r);
if(r<=mid)return quety(lid,l,r);
else return quety(lid,l,mid)+quety(rid,mid+1,r);
}
int main(void)
{
scanf("%d %d",&n,&m);
for(int i=1;i<=n;i++)scanf("%d",&a[i]);
build(1,1,n);
for(int i=0;i<m;i++)
{
int k,a,b;
scanf("%d%d%d",&k,&a,&b);
if(k==1)modity(1,a,b);
else ans[v++]=quety(1,a,b);
}
for(int i=0;i<v;i++)printf("%d\n",ans[i]);
}