#include <iostream>
#include <cmath>
#include <algorithm>
#include <string>
#include <array>
#include <vector>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <cassert>
#include <random>
#define rep(n) for (int (i) = 0; (i) < (n); (i)++)
#define all(n) (n).begin(), (n).end()
#define rall(n) (n).rbegin(), (n).rend()
#define mp make_pair
#define ll long long
#define ld long double
//#define FILE

using namespace std;

vector<int> get_ar(vector<int> &A) {
    int n = A.size();
    vector<int> B(n);
    vector<bool> used(n);
    int last_c = -1, idx = -1;
    rep(n) {
        for (int j = 0; j < n; j++) {
            if (!used[j]) {
                if (last_c != A[j]) {
                    idx = j;
                    break;
                }
                else
                    idx = idx == -1 ? j : idx;
            }
        }
        B[idx] = i + 1;
        used[idx] = true;
        last_c = A[idx];
        idx = -1;
    }
    return B;
}

void solve() {
    int n, q; cin >> n >> q;
    vector<int> A(n);
    rep(n) cin >> A[i];
    vector<int> B = get_ar(A);
    rep(q) {
        int ty; cin >> ty;
        int idx; cin >> idx;
        idx--;
        if (ty == 2) {
            cout << B[idx] << '\n';
        }
        else {
            swap(A[idx], A[idx + 1]);
            B = get_ar(A);
        }
    }
}

int main() {
    //ios_base::sync_with_stdio(false);
    //cin.tie(nullptr);
#ifdef FILE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "W", stdout);
#endif
    int tt = 1;
    //cin >> tt;
    while (tt--) {
        solve();
    }
}