rt,TLE
#include <bits/stdc++.h>
using namespace std;
const int N = 8010;
long long a[N], b[N];
int main() {
long long n, q, f, x, y;
cin >> n >> q;
for (int i = 1; i <= n; i++)
cin >> a[i], b[i] = a[i];
while(q--) {
cin >> f;
if(f == 1) {
cin >> x >> y;
a[x] = y;
for (int i = 1; i <= n; i++)
b[i] = a[i];
} else if(f == 2) {
int ans = 0;
cin >> x;
sort(b + 1, b + n + 1);
for (int i = 1; i < x; i++)
if(a[i] == a[x])
ans++;
for (int j = 1; j <= n; j++) {
if(a[x] == b[j]) {
cout << j + ans << endl;
break;
}
}
}
}
return 0;
}