#include <iostream>

using namespace std;

int main()
{
    int N,K;
    cin>>N>>K;
    int p[N],i;
    for (i=0;i<N;i++)
        cin>>p[i];
    if (p[N-1]==K)
        cout<<p[0];
    else
    {
        i=0;
        while (p[i]!=K)
            i++;
        cout<<p[i+1];
    }
    return 0;
}