#include "bits/stdc++.h"
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>

// using namespace __gnu_pbds;
// template<class T> 
// using ordered_set = <T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

using namespace std;

#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
using ll = long long;
using ld = long double;

#define int long long

void solve() {
    int n, q;
    cin >> n >> q;
    vector<int> a(n);
    for (int i =0 ; i < n; ++i) {
        cin >> a[i];
    }
    for (int i = 0; i < q; ++i) {
        int type;
        cin >> type;
        if (type == 1) {
            int x;
            cin >> x;
            swap(a[x - 1], a[x]);
        } else {
            int x;
            cin >> x;
            int ptr1 = -1;
            int ptr2 = 1;
            vector<bool> used(n, false);
            used[0] = true;
            int last_x = 0;
            x--;
            while (ptr2 < n && x) {
                if (ptr1 != -1) {
                    while (ptr1 != -1 && used[ptr1]) {
                        ptr1++;
                        if (ptr1 == ptr2) {
                            ptr1 = -1;
                        }
                    }
                    if (ptr1 != -1 && a[ptr1] != a[last_x]) {
                        used[ptr1] = true;
                        last_x = ptr1;
                        x--;
                        continue;
                    }
                }
                while (used[ptr2]) {
                    ptr2++;
                }
                while (ptr2 < n) {
                    if (a[ptr2] != a[last_x]) {
                        used[ptr2] =true;
                        last_x = ptr2;
                        x--;
                        break;
                    } else if (ptr1 == -1) {
                        ptr1 = ptr2;
                    }
                    ptr2++;
                }
            }
            if (x && ptr2 == n) {
                for (int i = 0; x > 0 && i < n; ++i) {
                    if (!used[i]) {
                        last_x = i;
                        x--;
                        used[i] = true;
                    }
                }
            }
            cout << last_x + 1 << '\n';
        }
    }
}

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

    #ifdef LOCAL
    freopen("C:\\Users\\User\\Documents\\olymp\\input.txt", "r", stdin);
    freopen("C:\\Users\\User\\Documents\\olymp\\output.txt", "w", stdout);
    #endif

    int t = 1;
    // cin >> t;
    while (t--) {
        solve();
    }

    return 0;
}