#pragma GCC optimize("Ofast")
#pragma GCC target("avx2", "bmi2", "popcnt", "lzcnt")
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <chrono>
#include <iostream>
#include <iomanip>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <numeric>
#include <climits>
#include <queue>
#include <random>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
#include <bit>

using namespace std;
using namespace __gnu_pbds;

typedef long long int lint;
typedef long double ld;
typedef tree<int, null_type, less<>, rb_tree_tag, tree_order_statistics_node_update> ost;

constexpr int MOD = (int) 1e9 + 7;
constexpr int INF = 998244353;

inline void preset() {
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
}

int n;

vector <int> f(vector <int> &a) {
    vector <int> b;
    vector <bool> used(n, false);
    b.push_back(0);
    used[0] = true;
    for (int i = 1; i < n;) if (!used[i]) {
        int x = i;
        while (x < n && (used[x] || a[x] == b.back())) {
            ++x;
        }
        if (x == n) x = i;
        b.push_back(x);
        used[b.back()] = true;
        if (x == i) ++i;
    } else ++i;
    return b;
}

int main() {
    preset();
    int q; cin >> n >> q;
    vector <int> a(n);
    for (auto &el: a) cin >> el;
    while (q--) {
        int cmd; cin >> cmd;
        if (cmd == 1) {
            int i;
            cin >> i;
            if (a[i - 1] == a[i]) continue;
            swap(a[i], a[i - 1]);
        }
        else {
            int i; cin >> i;
            --i;
            vector <int> b = f(a);
            cout << find(b.begin(), b.end(), i) - b.begin() + 1 << "\n";
        }
    }
    return 0;
}