#include <bits/stdc++.h>
using namespace std;
using ll = long long;
// #define int ll

void solve() {
    int n, q;
    cin >> n >> q;
    vector<int> a(n + 1);
    for (int i = 1; i <= n; i++) {
        cin >> a[i];
    }
    int t, x;
    for (int ts = 1; ts <= q; ts++) {
        cin >> t >> x;
        if (t == 1) {
            swap(a[x], a[x + 1]);
        } else {
            vector<int> used(n + 1);
            int last = 0;
            bool flag = false;
            for (int ord = 1; ord <= n && !flag; ord++) {
                bool norm = false;
                for (int i = 1; i <= n; i++) {
                    if (!used[i] && a[i] != last) {
                        used[i] = 1;
                        last = a[i];
                        if (i == x) {
                            cout << ord << "\n";
                            flag = true;
                        }
                        norm = true;
                        break;
                    }
                }
                if (norm) {
                    continue;
                }
                for (int i = 1; i <= n; i++) {
                    if (used[i]) {
                        continue;
                    }
                    used[i] = 1;
                    if (i == x) {
                        cout << ord << "\n";
                        flag = true;
                    }
                    break;
                }
            }
        }
    }
}

signed main() {
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    int t = 1;
    // cin >> t;
    for (int ts = 1; ts <= t; ts++) {
        solve();
    }
}
