#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace std;

using namespace __gnu_pbds;

template<typename T>
using ordered_set = tree<T, null_type, less<>, rb_tree_tag, tree_order_statistics_node_update>;
using ll = long long;

ll check(vector<ll> &a, ll x) {
    ll last = -1;
    vector<bool> used(a.size(), 0);
    ll cnt = 0;
    while (true) {
        bool k = 1;
        for (ll j = 0; j < a.size(); j++) {
            if (!used[j] && a[j] != last) {
                cnt++;
                used[j] = 1;
                last = a[j];
                if (j == x) {
                    return cnt;
                }
                k = 0;
                break;
            }
        }
        if (k == 1) break;
    }
    for (ll j = 0; j < a.size(); j++) {
        if (!used[j]) {
            cnt++;
            used[j] = 1;
            if (j == x) {
                return cnt;
            }
        }
    }
}

void solve() {
    ll n, q;
    cin >> n >> q;
    vector<ll> a(n);
    for (ll i = 0; i < n; i++) {
        cin >> a[i];
    }
    while (q--) {
        ll t;
        cin >> t;
        if (t == 1) {
            ll x;
            cin >> x;
            swap(a[x - 1], a[x]);
        } else {
            vector<ll> used(n, 0);
            ll x;
            cin >> x;
            x--;
            cout << check(a, x) << '\n';
        }
    }
}

signed main() {
    // #ifdef LOCAL
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    // #endif
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    ll t = 1;
    //cin >> t;
    while (t--) {
        solve();
    }
}