#include "bits/extc++.h"

using namespace std;
using namespace __gnu_pbds;

#define ordered_set tree<long long, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>;

random_device rd;
mt19937 rnd(rd());

// #pragma GCC optimize("O3", "unorll-loops")
// #pragma GCC target("avx2", "bmi", "bmi2", "popcnt", "lzcnt")

int rand(int l, int r) {
    if (r < l) assert(false);
    return uniform_int_distribution<int>(l, r)(rnd);
}

void solve() {
    int n, q;
    cin >> n >> q;

    vector<int> s(n);

    for (int i = 0; i < n; i++) {
        cin >> s[i];
    }

    vector<int> used(n);
    int time = 1;

    auto func = [&](int ind) {
        int last = -1;
        for (int i = 0; i < n; i++) {
            for (int j = 0; j < n; j++) {
                if (used[j] != time && last != s[j]) {
                    last = s[j];
                    used[j] = time;
                    if (j == ind - 1) return i + 1;
                    break;
                }
            }
        }
        return n;
    };

    while (q--) {
        time++;
        int t; cin >> t;
        int ind; cin >> ind;

        if (!(t - 1)) {
            swap(s[ind], s[ind - 1]);
            continue;
        }

        cout << func(ind) << '\n';
    }
}

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

    int akbalin = 1;
    // cin >> akbalin;

    while (akbalin--) solve();
}