#include <bits/stdc++.h>

using namespace std;

const long long C = 1e18;

int main() {
    int n, q;
    cin >> n >> q;
    vector <int> v(n);
    for (int i = 0; i < n; ++i) {
        cin >> v[i];
    }
    while (q--) {
        int t, x;
        cin >> t >> x;
        if (t == 1) {
            swap(v[x], v[x - 1]);
        } else {
            vector <int> used(n, 0);
            used[0] = 1;
            int j = 0;
            x--;
            int cnt = 1;
            while (j != x) {
                bool cf = false;
                for (int i = 0; i < n; ++i) {
                    if (!used[i] && v[i] != v[j]) {
                        j = i;
                        used[i] = 1;
                        cf = true;
                        break;
                    }
                }
                if (!cf) {
                    for (int i = 0; i < n; ++i) {
                        if (!used[i]) {
                        j = i;
                        used[i] = 1;
                        break;
                        }
                    }
                }
                cnt++;
            }

            cout << cnt << endl;
        }
    }
    return 0;
}
