#include <bits/stdc++.h>

using namespace std;
using ll = long long;

signed main() {
    ll n, q;
    cin >> n >> q;
    vector<ll> v(n);
    for (ll i = 0; i < n; i++) cin >> v[i];
    while (q--) {
        ll t, x;
        cin >> t >> x;
        if (t == 1) {
            swap(v[x - 1], v[x]);
        } else {
            cout << x << endl;
        }
    }
}
