#include <iostream>
using namespace std;
int n,k;
int main()
{
    cin>>n>>k;
    //if(previous==k)trazeno=current;
    int previous,current,trazeno,prvaKarta;
    cin>>previous;
    prvaKarta=previous;
    for(int i=1;i<n;i++)
    {
        cin>>current;
        if(previous==k)trazeno=current;
        previous=current;
    }
    if(current==k)
        cout<<prvaKarta;
    else
        cout<<trazeno;
}