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

const ll mod = 998244353;

ll binpow(ll x, ll st) {
    if (st == 0) return 1;
    if (st == 1) return x % mod;
    ll bp = binpow(x, st / 2) % mod;
    if (st % 2 == 0) return bp % mod * bp % mod;
    return bp % mod * bp % mod * x % mod;
}

ll n, q;

vector<ll> calc(vector<ll>& arr) {
    vector<ll> dp(n);
    vector<ll> used(n);
    ll last = arr[0];
    dp[0] = 1;
    used[0] = 1;
    ll cur = 2;
    bool ost = false;
    for (ll i = 1; i < n; ++i) {
        if (used[i]) continue;
        if (arr[i] == last && !ost) {
            bool finded = false;
            for (ll j = 0; j < n; ++j) {
                if (!used[j] && arr[j] != last) {
                    last = arr[j];
                    used[j] = true;
                    dp[j] = cur;
                    ++cur;
                    --i;
                    finded = true;
                    break;
                }
            }        
            if (!finded) ost = true;
            if (finded) continue;
        }
        last = arr[i];
        used[i] = true;
        dp[i] = cur;
        ++cur;
    }
    return dp;
}

void solve() {
    cin >> n >> q;
    vector<ll> arr(n);
    for (ll i = 0; i < n; ++i) {
        cin >> arr[i];
    }
    vector<ll> dp = calc(arr);
    while (q--) {
        ll com;
        cin >> com;
        if (com == 1) {
            ll x;
            cin >> x;
            --x;
            swap(arr[x], arr[x + 1]);
            dp = calc(arr);
        } else {
            ll y;
            cin >> y;
            --y;
            ll ans = dp[y];
            cout << "" << ans << '\n';
        }
    }
}

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    ll t = 1;
    while (t--) {
        solve();
    }
}