#include <bits/stdc++.h>
#pragma GCC optimize("O3,unroll-loops")
#pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt")
using namespace std;
#define int long long
int answer(vector<int> nums, int y) {
    vector<bool> wasted(nums.size(), false);
    int k = 1;
    int last = 0;
    bool changed = true;
    while (k <= nums.size() && changed) {
        changed = false;
        for (int i = 0; i < nums.size(); i++) {
            if (!wasted[i] && nums[i] != last) {
                if (y == i) return k;
                k++;
                last = nums[i];
                wasted[i] = true;
                changed = true;
                break;
            }
        }
    }
    for (int i = 0; i < nums.size(); i++) {
        if (!wasted[i]) {
            if (i == y) return k;
            k++;
        }
    }
    return nums.size();
}

signed main() {
    int n, q;
    cin >> n >> q;
    vector<int> nums(n);
    for (int i = 0; i < n; i++) cin >> nums[i];
    while (q--) {
        int t;
        cin >> t;
        if (t == 1) {
            int x;
            cin >> x;
            x--;
            swap(nums[x], nums[x + 1]);
        } else if (t == 2) {
            int y;
            cin >> y;
            y--;
            cout << answer(nums, y) << '\n';
        }
    }
}
