#include <bits/stdc++.h>

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

const int maxn = 1e5 + 10;

void solve() {
    int n, m;
    cin >> n >> m;
    vector<int> a(n + 1);
    for (int i = 1; i <= n; i++) {
        cin >> a[i];
    }
    int cnt = 1;
    int last = 0;
    queue<pair<int, int>> q;
    vector<int> ord(n + 1);
    for (int i = 1; i <= n; i++) {
        if (!q.empty() && q.front().first != last) {
            auto [c, ind] = q.front();
            q.pop();
            ord[ind] = cnt++;
            last = c;
            i--;
            continue;
        }
        if (a[i] == last) {
            q.push({a[i], i});
        } else {
            ord[i] = cnt++;
            last = a[i];
        }
    }
    while (!q.empty()) {
        auto [c, ind] = q.front();
        q.pop();
        ord[ind] = cnt++;
    }
    while (m--) {
        int t;
        cin >> t;
        if (t == 1) {
            int x; cin >> x;
            swap(ord[x], ord[x + 1]);
            continue;
        }
        int y; cin >> y;
        cout << ord[y] << '\n';
    }
}

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