//#define _GLIBCXX_DEBUG 1
//#pragma GCC optimize ("03, unroll-seen")
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
const ll inf = 1e18, mod = 998244353;

ll f(ll zn, ll st) {
    if (st==1)
        return zn;
    if (st%2==0) {
        ll k = f(zn, st/2);
        return k*k%mod;
    }
    if (st%2==1) {
        ll k = f(zn, st-1);
        return k*zn%mod;
    }
}
signed main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    //ifstream cin ("input.txt");
    //ofstream cout ("output.txt");
    int n, m;
    cin >> n >> m;
    vector<ll> a(n);
    for (int i = 0; i < n; i++)
        cin >> a[i];
    while (m--) {
        int t;
        cin >> t;
        if (t==1) {
            int x;
            cin >> x;
            x--;
            swap(a[x], a[x+1]);
        } else {
            int y;
            cin >> y;
            y--;
            int cou = 1;
            int ls = 0;
            vector<bool> f(n);
            f[0] = 1;
            while (ls!=y) {
                int pos = -1;
                for (int i = 0; i < n; i++)
                    if (!f[i]&&a[i]!=a[ls]) {
                        pos = i;
                        break;
                    }
                if (pos==-1) {
                    for (int i = 0; i < n; i++)
                        if (!f[i]) {
                            pos = i;
                            break;
                        }
                }
                f[pos] = 1;
                cou++;
                ls = pos;
            }
            cout << cou << '\n';
        }
    }
}