#include <bits/stdc++.h>

using namespace std;
using ll = long long;

#define pb push_back
#define all(x) (x).begin(), (x).end()
#define sz(x) (int) (x).size()

vector<int> sol(vector<int>a ) {
    int n = sz(a);
    vector<int> used(n),ans(n);
    int lst = -1;
    for (int j = 0; j < n; j++) {
        bool f = false;
        for (int i = 0; i < n; i++) {
            if (a[i]!=lst&&!used[i]) {
                lst=a[i];
                ans[i] = j+1;
                used[i]=1;
                f=1;
                break;
            }
        }
        if (!f) {
            for (int i = 0; i< n;i++) {
                if (!used[i]) {
                    ans[i] = j + 1;
                    used[i]=1;break;
                }
            }
        }
    }
    return ans;
}

void solve() {
    int n,q ; cin >>n >> q;
    vector<int> a(n);
    for(auto&u:a) cin >> u;
    while (q--) {
        int t; cin >> t;
        if (t == 1) {
            int x; cin >>x ;
            x--;
            swap(a[x], a[x + 1]);
        } else {
            int y; cin >> y;
            y--;
            cout << sol(a)[y] << '\n';
        }
        // for (auto &u : sol(a)) cout << u << ' ';
        // cout<< endl;
    }
}

signed main() {
    int t = 1;
    #ifdef LOCAL
        freopen("in.txt", "r", stdin);
        freopen("out.txt", "w", stdout);
        cin >> t;
    #else 
        cin.tie(0)->sync_with_stdio(false);
    #endif 

    while (t--) solve();

    return 0;
}