#include <iostream>
#include <algorithm>
#include <vector>
#include <array>
#include <queue>
#include <deque>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <iomanip>
#include <cmath>
#include <ctime>
#include <cassert>
#include <ctime>
#include <random>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

// #pragma GCC optimize("Ofast")
// #pragma ivdep

using namespace std;
using ll = long long;
using ld = long double;
using lll = __int128;
using pii = pair<int, int>;
// using namespace __gnu_pbds;
// template<class T>
// using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

void recalc(int n, const int* arr, int* ans) {
    queue<int> q;
    int col = -1;
    int t = 0;
    for (int i = 0; i < n; ++i) {
        if (q.size() && arr[q.front()] != col) {
            col = arr[q.front()];
            ans[q.front()] = ++t;
            q.pop();
            --i;

        } else if (arr[i] != col) {
            col = arr[i];
            ans[i] = ++t;

        } else {
            q.push(i);
        }
    }

    while (q.size()) {
        ans[q.front()] = ++t;
        q.pop();
    }
}

void solve() {
    int n, q; cin >> n >> q;
    int arr[n];
    for (int& i : arr)
        cin >> i;
    int ans[n];
    recalc(n, arr, ans);

    for (int _ = 0; _ < q; ++_) {
        int a, b; cin >> a >> b;
        --b;
        if (a == 2)
            cout << ans[b] << '\n';
    }
}

int main() {
    cin.tie(0)->sync_with_stdio(0);

    int _ = 1;
    #ifdef DEBUG
        freopen("in.txt", "r", stdin);
        freopen("out.txt", "w", stdout);
        cin >> _;
    #endif

    while (_--) {
        solve();
        cout << '\n';
    }

    return 0;
}
