#include <bits/stdc++.h>

using namespace std;

int main()
{
    int n, k;
    cin >> n >> k;
    int i = 0;
    int niz[n];
    int p;
    for (;i < n; i++)
    {
        cin >> niz[i];
        if (niz[i] == k)
        {
            if (i == n-1)
                p = niz[0];
            else
            {
                cin >> niz[i+1];
                p = niz[i+1];
                i++;
            }
        }

    }
    cout << p;
}