#include<bits/stdc++.h>
using namespace std;
#define ll long long
long long read(){
long long x=0;
int f=1;
char c=getchar();
while(c>'9'||c<'0'){
if(c=='-')f=-1;
c=getchar();
}
while(c>='0'&&c<='9'){
x=(x<<1)+(x<<3)+(c^'0');
c=getchar();
}
return x*f;
}
ll tree[200001<<2];
ll lazy[200001<<1];
int n,q;
void pushup(ll &a,const ll &a1,const ll &a2){
a=a1+a2;
}
void build(int x,int l,int r){
if(l==r){
tree[x]=read();
}else{
int mid=(l+r)>>1;
build(x<<1,l,mid);
build(x<<1|1,mid+1,r);
pushup(tree[x],tree[x<<1],tree[x<<1|1]);
}
}
void pushdown(int x,int l,int r){
if(lazy[x]){
int mid=(l+r)>>1;
lazy[x<<1]=lazy[x];
lazy[x<<1|1]=lazy[x];
tree[x<<1]=lazy[x]*(mid-l+1);
tree[x<<1|1]=lazy[x]*(r-mid);
lazy[x]=0;
}
}
void update_set(int x,int l,int r,int L,int R,ll val){
if(L<=l&&r<=R){
tree[x]=(r-l+1)*val;
lazy[x]=val;
}else{
int mid=(l+r)>>1;
pushdown(x,l,r);
if(L<=mid){
update_set(x<<1,l,mid,L,R,val);
}
if(R>mid){
update_set(x<<1|1,mid+1,r,L,R,val);
}
pushup(tree[x],tree[x<<1],tree[x<<1|1]);
}
}
void update_point(int x,int l,int r,int T,ll val){
if(l==r){
tree[x]=val;
}else{
int mid=(l+r)>>1;
pushdown(x,l,r);
if(T<=mid){
update_point(x<<1,l,mid,T,val);
}else{
update_point(x<<1|1,mid+1,r,T,val);
}
pushup(tree[x],tree[x<<1],tree[x<<1|1]);
}
}
int main(){
n=read();
q=read();
build(1,1,n);
int opt,j;
ll xx;
for(int i=1;i<=q;i++){
opt=read();
if(opt==1){
j=read();
xx=read();
update_point(1,1,n,j,xx);
printf("%lld\n",tree[1]);
}else{
xx=read();
update_set(1,1,n,1,n,xx);
printf("%lld\n",tree[1]);
}
}
return 0;
}