#include<bits/stdc++.h>
using namespace std;
const int N = 8010;
int n,m;
int a[N],b[N],c[N];
/*
bool cmp(int x,int y)
{
if(a[x] != a[y]) return a[x] < a[y]; //值不同,按值比
return x < y; //值相同,按下标比
}
*/
int main()
{
scanf("%d%d",&n,&m);
for(int i = 1 ; i <= n ; i ++)
{
scanf("%d",&a[i]);
b[i] = i;
}
//双关键词排序
sort(b + 1 , b + 1 + n ,[&](int x,int y)
{
if(a[x] != a[y]) return a[x] < a[y];
return x < y;
});
//sort(b + 1,b + 1 + n,cmp);
for(int i = 1 ; i <= n ; i ++) c[b[i]] = i;
while(m --)
{
int ope,p,x;
scanf("%d%d",&ope,&p);
if(ope == 1)
{
scanf("%d",&x);
a[p] = x;
int k = c[p];
//插入排序
while(k > 1 && (a[b[k-1]] > a[b[k]] || (a[b[k-1]] == a[b[k]] && b[k-1] > b[k])))
{
swap(b[k],b[k-1]);
swap(c[b[k-1]],c[b[k]]);
k --;
}
while(k < n && (a[b[k]] > a[b[k+1]] || (a[b[k]] == a[b[k+1]] && b[k] > b[k+1])))
{
swap(b[k],b[k+1]);
swap(c[b[k]],c[b[k+1]]);
k ++;
}
}
else printf("%d\n",c[p]);
}
return 0;
}