#include <iostream>

using namespace std;

int main()
{
    // Unos
    int n, k;
    cin >> n >> k;
    int niz[n];
    for (int i = 0; i < n; i++)
    {
        cin >> niz[i];
    }

    //Obrada
    int p = -1, br = 0;
    while (p == -1)
        if(niz[br] == k) p = br;
        else br++;

    //Stampa
    cout << niz[(p+1) % n];

    return 0;
}