#include <bits/stdc++.h>

using namespace std;

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);

    int n, q;

    cin >> n >> q;

    vector<int> lst_els(n, 0);

    for (int i = 0; i < n; ++i){
        cin >> lst_els[i];
    }

    for (int i = 0; i < q; ++i){
        int type;

        cin >> type;

        if (type == 1){
            int ind;
            cin >> ind;
            ind--;

            swap(lst_els[ind], lst_els[ind+1]);
        } else {
            int ind;
            cin >> ind;
            ind--;
            int cnt_process = 0;
            vector<int> ans(n, -1);

            int last = -1;

            for (int k = 0; k < n; ++k){
                for (int j = 0; j < n; ++j){
                    if (ans[j] == -1 && lst_els[j] != last){
                        last = lst_els[j];
                        cnt_process++;
                        ans[j] = cnt_process;
                        break;
                    }
                }
            }

            for (int j = 0; j < n; ++j){
                if (ans[j] == -1){
                    cnt_process++;
                    ans[j] = cnt_process;
                }
            }

            cout << ans[ind] << "\n";
        }
    }
}