#include <bits/stdc++.h>

using namespace std;
using ll = long long;
#define all(x) x.begin(), x.end()

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

    ll n, q;
    cin >> n >> q;
    vector<ll> a(n);
    for (auto & el : a) cin >> el;
    set<pair<ll, ll>> s;
    for (int i = 0; i < n; ++i) {
        s.insert({i, a[i]});
    }

    for (int op = 0; op < q; ++op) {
        ll t;
        cin >> t;
        if (t == 2) {
            ll k;
            cin >> k;
            k--;
            if (k == 1) {
                cout << 1 << '\n';
                continue;
            }
            vector<ll> used(n);
            used[0] = 1;
            ll cnt = 0;
            bool f = 1;
            ll cur = 0;
            for (int i = 0; i < n - 1; ++i) {
                for (int j = 0; j < n; ++j) {
                    if (!used[j] && a[j] != a[cur]) {
                        cur = j;
                        f = 0;
                        cnt++;
                        used[cur] = 1;
                        if (cnt == k) {
                            cout << j + 1 << '\n';
                        }
                        cur = j;
                        break;

                    }
                }
                if (f) {
                    for (int j = 0; j < n; ++j) {
                        if (!used[j]) {
                            used[j] = 1;
                            cnt++;
                            if (cnt == k) {
                                cout << j + 1 << '\n';
                                break;
                            }
                        }
                    }
                }
                f = 1;
            }
        } else {
            ll x;
            cin >> x;
            x--;
            swap(a[x], a[x + 1]);
        }
    }
}