#include <iostream>
#include <vector>
#include <cstring>
#include <string>
#include <iomanip>
#include <algorithm>
#include <fstream>
#include <cmath>
#include <unordered_set>
#include <set>
#include <unordered_map>
#include <queue>
#define ll long long
#define X first
#define Y second
#define endl '\n'
using namespace std;

void speed()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
}
int n, q;
const int MAXN = 10010;
int a[MAXN];
void read()
{
    cin >> n >> q;
    for (int i = 1; i <= n; i++)
        cin >> a[i];
}
int ans[MAXN];
void getans()
{
    int prv = a[1];
    ans[1] = 1;
    int cnt = 2;
    queue<int> q;
    for (int i = 2; i <= n; i++)
    {
        while (q.size() && a[q.front()] != prv)
        {
            ans[q.front()] = cnt;
            cnt++;
            prv = a[q.front()];
            q.pop();
        }
        if (a[i] != prv)
        {
            ans[i] = cnt;
            cnt++;
            prv = a[i];
        }
        else
            q.push(i);
    }
    while (q.size())
    {
        ans[q.front()] = cnt;
        cnt++;
        prv = a[q.front()];
        q.pop();
    }
}
signed main()
{
    speed();
    read();
    bool ac = 1;
    getans();
    while (q--)
    {
        int t, x;
        cin >> t >> x;
        if (t == 1)
        {
            ac = 0;
            swap(a[x], a[x + 1]);
        }
        else
        {
            if (ac == 0)
                getans();
            cout << ans[x] << endl;
        }
    }
    return 0;
}