#include <iostream>
#include <algorithm>
#include <iomanip>
#include <cmath>
#include <numeric>
#include <cassert>
#include <vector>
#include <map>

#define all(a) a.begin(), a.end()
#define int int64_t

using namespace std;

signed main() {
	int n, q;
	cin >> n >> q;
	vector<int> a(n);
	for (int i = 0; i < n; ++i) cin >> 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;
			int i = 0, j = 0, lst = -1, now = 1;
			vector<bool> used(n, false);
			while (true) {
				if (used[i]) {
					++i;
					continue;
				}
				if (a[i] != lst) {
					if (i == y) {
						cout << now<< '\n';
						break;
					}
					used[i] = true;
					++now;
					lst = a[i];
					++i;
					j = max(j, i);
				} else if (j != n) {
					if (a[j] != lst) {
						if (j == y) {
							cout << now << '\n';
							break;
						}
						used[j] = true;
						++now;
						lst = a[j];
						++j;
					} else {
						++j;
					}
				} else {
					if (i == y) {
						cout << now << '\n';
						break;
					}
					used[i] = true;
					++now;
					lst = a[i];
					++i;
				}
			}
		}
	}
}