#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <random>
#include <ctime>
#include <stack>
#include <deque>
#include <queue>
#include <climits>
#include <cmath>
#include <bitset>
using namespace std;
#define all(a) (a).begin(), (a).end()
#define mid (l + r) / 2
#define int long long

constexpr int maxn = 500'005;
int a[maxn];
bitset<maxn> used;

void solve() {
    int n, q; cin >> n >> q;
    for (int i = 0; i < n; i++) {
        cin >> a[i];
    }
    for (int iq = 0; iq < q; iq++) {
        int t; cin >> t;
        if (t == 1) {
            int x; cin >> x;
            swap(a[x - 1], a[x]);
        } else {
            int y; cin >> y;
            if (y == 1) {
                cout << 1 << '\n';
                continue;
            }
            y--;
            used.reset();
            used[0] = true;
            int moves = 0;
            int i = 0;
            while (true) {
                for (int j = 0; j < n; j++) {
                    if (!used[j] && a[j] != a[i]) {
                        i = j;
                        goto skip;
                    }
                }
                i++;
                skip:
                moves++;
                used[i] = true;
                if (i == y) {
                    cout << moves + 1 << '\n';
                    break;
                }
            }
        }
    }
}

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