#include <iostream>
#include <vector>

using namespace std;

int main(void)
{
    unsigned short int n, k;

    cin >> n >> k;  // n - broj karata u spilu, k - broj na karti iznad izvucene

    vector<unsigned int> spil;

    for(unsigned short int i=0; i<n; ++i)
    {
        unsigned short int x;
        cin >> x;
        spil.push_back(x);
    }

    if(spil[n-1] == k)
        cout << spil[0] << endl;
    else
    {
        for(unsigned int i=0; (i+1)<n; ++i)
        {
            if(spil[i+1] == k)
                cout << spil[i] << endl;
        }
    }

    return 0;
}