#include using namespace std; const int N = 10005; pair arr[N]; int b[N]; int main() { int n, m; scanf("%d%d", &n, &m); for (int i = 1; i <= n; i++) { scanf("%d", &arr[i].first); arr[i].second = i; } sort(arr + 1, arr + n + 1); for (int i = 1; i <= n; i++) b[arr[i].second] = i; while (m--) { int op, x, y; scanf("%d", &op); if (op == 1) { scanf("%d%d", &x, &y); arr[b[x]].first = y; for (int i = 1; i < n; i++) { if (arr[i] > arr[i + 1]) swap(arr[i], arr[i + 1]); } for (int i = n - 1; i >= 1; i--) { if (arr[i] > arr[i + 1]) swap(arr[i], arr[i + 1]); } for (int i = 1; i <= n; i++) b[arr[i].second] = i; } else { scanf("%d", &x); printf("%d\n", b[x]); } } return 0; }