#include <iostream>
#include <vector>
#include <unordered_map>
#include <unordered_set>
#include <map>
#include <set>
#include <algorithm>
#include <chrono>
#include <random>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
#define its(a) a.begin(), a.end()
#define scan(a) {for (int i = 0; i < a.size(); ++i) cin >> a[i];}
constexpr ll INFLL = 1e18 + 130;
constexpr int INFINT = 1e9 + 13;
constexpr int MAXN = 1e6;
constexpr int LOGN = 18;
constexpr int M = 998'244'353;
std::mt19937 rnd(std::chrono::high_resolution_clock::now().time_since_epoch().count());

int binPow(int a, int n) {
	if (!n) return 1;
	if (n & 1) return 1ll * a * binPow(a, n - 1) % M;
	return binPow(1ll * a * a % M, n / 2);
}

void solve() {
	int n, q; cin >> n >> q;
	vector <int> a(n);
	for (int i = 0; i < n; ++i) {
		cin >> a[i]; a[i]--;
	}
	while (q--) {
		int t; cin >> t;
		if (t & 1) {
			int x; cin >> x;
			x--;
			swap(a[x], a[x + 1]);
		}
		else {
			int y; cin >> y; y--;
			vector <int> used(n);
			int cur = -1, cnt = 1;
			for (int i = 0; i < n; ++i) {
				bool found = false;
				for (int j = 0; j < n; ++j) {
					if (!used[j] && a[j] != cur) {
						cur = a[j];
						used[j] = cnt++;
						found = true;
						break;
					}
				}
				if (!found) {
					for (int j = 0; j < n; ++j) {
						if (!used[j]) {
							used[j] = cnt++;
							break;
						}
					}
				}
			}
			cout << used[y] << "\n";
		}
	}
}


int gen(int l, int r) {
	return uniform_int_distribution<int>(l, r)(rnd);
}

int main() {
	cin.tie(nullptr)->sync_with_stdio(false);
	solve();
}

/*
*/