#include <iostream>

using namespace std;

int karta[1000000];

int main()
{
    int n, k,rez;
    int f = 0;
    cin >> n >> k;

    for (int i = 0; i < n; i++)
    {
        cin >> karta[i];
        if (f == 1)
        {
            rez = karta[i];
        }
        if (karta[i] == k)
        {
            if (i == n - 1)
            {
                rez = karta[0];
            }
            else
            {
                f = 1;
            }
        }
    }
    cout << rez;
}