#include <bits/stdc++.h>
#include <random>

#define i128 __int128
#define int long long

using namespace std;

random_device lal;
mt19937 rnd(lal());


const int inf = 1e18, mod = 998'244'353;
const int sg_base = 524288, sg_size = sg_base * 2 - 1;


signed main() {
    // ios::sync_with_stdio(0);
    // cin.tie(0);
    int n, q;
    cin >> n >> q;
    vector<int> a(n);
    for (int &i: a) { cin >> i; }
    while (q--) {
        int t, x, y;
        cin >> t;
        if (t == 1) {
            cin >> x;
            --x;
            if (a[x] == a[x + 1]) { continue; }
            swap(a[x], a[x + 1]);
        } else {
            cin >> y;
            --y;
            if (y == 0) {
                cout << 1 << '\n';
                continue;
            }
            vector<bool> used(n);
            used[0] = true;
            int last = 0, cnt = 1;
            bool got = false;
            while (!got) {
                bool lol = false;
                for (int i = 1; i < n; ++i) {
                    if (a[i] != a[last] && !used[i]) {
                        ++cnt;
                        lol = true;
                        last = i;
                        used[i]=true;
                        if (i == y) {
                            cout << cnt << '\n';
                            got = true;
                        }
                        break;
                    }
                }
                if (!lol) {
                    for (int i = 1; i < n; ++i) {
                        if (!used[i]) {
                            ++cnt;
                            if (i == y) {
                                cout << cnt << '\n';
                                got = true;
                                break;
                            }
                        }
                    }
                }
            }
        }
    }
}
