#include <bits/stdc++.h>

using namespace std;
using ll = long long;

const ll M = 998244353;

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);

    int n, q;
    cin >> n >> q;
    vector<int> a(n);
    for (int i = 0; i < n; i++) {
        cin >> a[i];
    }
    while (q--) {
        int type;
        cin >> type;
        if (type == 1) {
            int x;
            cin >> x;
            swap(a[x - 1], a[x]);
        } else {
            int y;
            cin >> y;
            int last = -1;
            vector<int> used(n);
            for (int i = 0; i < n; i++) {
                bool f = 0;
                for (int j = 0; j < n; j++) {
                    if (!used[j] && a[j] != last) {
                        last = a[j];
                        used[j] = i + 1;
                        f = 1;
                        break;
                    }
                }
                if (f == 0) {
                    for (int j = 0; j < n; j++) {
                        if (used[j] == 0) {
                            used[j] = i + 1;
                            break;
                        }
                    }
                }
            }
            cout << used[y - 1] << '\n';
        }
    }
}
