#include<bits/stdc++.h>
using namespace std;
int n,q,a[8005],num,x,v,ans;
struct zzzz{
int z,h;
}b[8005];
bool cmp(zzzz e,zzzz r){
if(e.z==r.z){
return e.h<r.h;
}
return e.z<r.z;
}
int main(){
cin>>n>>q;
for(int i=1;i<=n;i++){
cin>>a[i];
}
for(int i=0;i<q;i++){
cin>>num;
if(num==1){
cin>>x>>v;
a[x]=v;
}else{
cin>>x;
for(int j=1;j<=n;j++){
b[j].z=a[j];
b[j].h=j;
}
sort(b+1,b+n+1,cmp);
for(int j=1;j<=n;j++){
if(b[j].z==a[x]&&b[j].h==x){
cout<<j<<endl;
break;
}
}
}
}
return 0;
}