#include <bits/stdc++.h>
using namespace std;
const int N=8000+5;
int n,q;
int a[N];
int main(){
freopen ("csp2021pj_sort.in","r",stdin);
freopen ("csp2021pj_sort.out","w",stdout);
scanf("%d%d",&n,&q);
for (int i=1;i<=n;i++){
scanf("%d",&a[i]);
}
for (int i=1;i<=q;i++){
int t,x,y;
scanf("%d",&t);
if (t==1){
scanf("%d%d",&x,&y);a[x]=y;
}
else{
scanf("%d",&x);
int ans=1;
for (int j=1;j<=n;j++){
if (a[j]==a[x]&&j<x)ans++;
if (a[j]<a[x])ans++;
}
printf("%d\n",ans);
}
}
}