#include <bits/stdc++.h>

using namespace std;
using ll = long long;

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int n, q; cin >> n >> q;
    vector<int> a(n);
    for (int& o : a) cin >> o;
    vector<int> p(2 * n);
    int i = 0, j = 1, f = 0;
    for (int k = 1; k <= n; k++) {
        while (p[i]) i++;
        while (p[j]) j++;
        while (j < n and i < n and a[i] == a[j]) j++;
        if (f != a[i] or j >= n) p[i] = k, f = a[i];
        else p[j] = k, f = a[j];
    }
    while (q--) {
        int t; cin >> t;
        if (t == 2) {
            int x; cin >> x;
            cout << x << '\n';
        } else {
            int x; cin >> x;
            // swap(a[x - 1], a[x]);
            // i = 0, j = 1, f = 0;
            // p = vector<int>(2 * n);
            // for (int k = 1; k <= n; k++) {
                // while (p[i]) i++;
                // while (p[j]) j++;
                // while (j < n and i < n and a[i] == a[j]) j++;
                // if (f != a[i] or j >= n) p[i] = k, f = a[i];
                // else p[j] = k, f = a[j];
            // }
        }
    }
    return 0;
}
