#include <bits/stdc++.h>

#define all(v) v.begin(), v.end()
#define len(v) (int)v.size()

using namespace std;
using ll = long long;
using ld = long double;

void solve()
{
    int n, q;
    cin >> n >> q;
    vector<int> a(n);
    for (int i = 0; i < n; ++i)
    {
        cin >> a[i];
    }
    for (int i = 0; i < q; ++i)
    {
        int t;
        cin >> t;
        if (t == 1)
        {
            int j;
            cin >> j;
            --j;
            swap(a[j], a[j + 1]);
        } else
        {
            int j;
            cin >> j;
            --j;
            vector<int> ban(n, 0);
            vector<int> pl(n);
            pl[0] = 0;
            ban[0] = 1;
            int lt = a[0];
            for (int i = 1; i < n; ++i)
            {
                bool c = 0;
                for (int j = 0; j < n; ++j)
                {
                    if (!ban[j] && a[j] != lt)
                    {
                        lt = a[j];
                        ban[j] = 1;
                        pl[j] = i;
                        c = 1;
                        break;
                    }
                }
                if (!c)
                {
                    for (int j = 0; j < n; ++j)
                    {
                        if (!ban[j])
                        {
                            lt = a[j];
                            ban[j] = 1;
                            pl[j] = i;
                            c = 1;
                            break;
                        }
                    }
                }
            }
            cout << pl[j] + 1 << '\n';
        }
    }
}

int main()
{
    cin.tie(0)->sync_with_stdio(0);
    int t = 1;
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);

    //cin >> t;

    while (t--)
    {
        solve();
        cout << '\n';
    }
    return 0;
}

