#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

vector<int> answer(vector<int> nums) {
    vector<int> wasted(nums.size(), 0);
    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] == 0 && nums[i] != last) {
                last = nums[i];
                wasted[i] = k;
                changed = true;
                k++;
                break;
            }
        }
    }
    for (int i = 0; i < nums.size(); i++) {
        if (wasted[i] == 0) {
            wasted[i] = k;
            k++;
        }
    }
    return wasted;
}

signed main() {
    ios::sync_with_stdio(0);
    cin.tie(0);

    int n, q;
    cin >> n >> q;
    vector<int> nums(n);
    for (int i = 0; i < n; i++) cin >> nums[i];
    vector<int> now = answer(nums);
    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';
        }
    }
}
