#include <iostream>
#define MAX_N 20000
using namespace std;
int main()
{
    int n, k, l, niz[MAX_N];
    cin >> n >> k;
    for (int i = 0; i < n; i++)
    {
        cin >> niz[i];
        if (niz[i] == k)
        {
            if (i == n - 1) {
                l = 0;
            }
            else l = i + 1;
        }
    }
    cout << niz[l];
    return 0;
}