#include "bits/extc++.h"
//#pragma optimize("O3")
//#pragma target("avx2,popcnt")
//#pragma target("unroll-loops")
using namespace std;
using namespace __gnu_pbds;
using ll = long long;

using ordered_set = tree<int, null_type, less<>, rb_tree_tag, tree_order_statistics_node_update>;

template<typename T>
istream & operator>>(istream &is, vector<T> &a){
    for (auto &v: a) is >> v;
    return is;
}

template<typename T>
ostream & operator<<(ostream &os, vector<T> &a){
    for (auto &v: a) os << v << " ";
    return (os << "\n");
}

signed main() {
#ifdef LOCAL
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#else
    ios_base::sync_with_stdio(false);
    cin.tie(0);
#endif

    int n, Q;
    cin >> n >> Q;

    vector<int> a(n);
    cin >> a;

    for (int i = 0; i < n; ++i) {
        a[i]--;
    }

    while (Q--){
        int t;
        cin >> t;

        if (t==1){
            int i;
            cin >> i;

            swap(a[i-1],a[i]);
            continue;
        }

        int x;
        cin >> x;
        x--;

        int last = -1;
        vector<int> used(n);
        int ans = -1;
        for (int it = 0; it < n; ++it) {
            bool flag = false;
            for (int i = 0; i < n; ++i) {
                if (!used[i] && a[i] != last){
                    flag = true;
                    used[i] = it + 1;
                    last=a[i];
                    break;
                }
            }
            if (!flag){
                for (int i = 0; i < n; ++i) {
                    if (!used[i]){
                        used[i] = it + 1;
                        last=a[i];
                        break;
                    }
                }
            }
        }
        cout << used[x] << "\n";
    }
}