#include <bits/stdc++.h>

using namespace std;
using ll = long long;
using ld = long double;

void solve() {
    int n, q;
    cin >> n >> q;

    vector<int> a(n);
    for (auto &i: a) cin >> i;

    int time = 1, last = -1;
    vector<int> res(n);
    for (int i = 0; i < n; ++i) {
        for (int j = 0; j < n; ++j) {
            if (res[j] == 0 && a[j] != last) {
                res[j] = time++, last = a[j];
                break;
            }
        }
    }
    for (int i = 0; i < n; ++i) {
        if (res[i] == 0) res[i] = time++;
    }

    while (q--) {
        int t;
        cin >> t;

        if (t == 1) {
            int x;
            cin >> x;
            if (a[x - 1] == a[x]) continue;
            swap(a[x - 1], a[x]);

            time = 1, last = -1;
            fill(res.begin(), res.end(), 0);
            for (int i = 0; i < n; ++i) {
                for (int j = 0; j < n; ++j) {
                    if (res[j] == 0 && a[j] != last) {
                        res[j] = time++, last = a[j];
                        break;
                    }
                }
            }
            for (int i = 0; i < n; ++i) {
                if (res[i] == 0) res[i] = time++;
            }
        } else {
            int y;
            cin >> y, y--;
            cout << res[y] << "\n";
        }
    }
}

signed main() {
#ifdef LOCAL
    freopen("input.txt", "r", stdin);
    freopen("answer.txt", "w", stdout);
#endif
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    int t = 1;
//    cin >> t;
    while (t--) solve();
}