#include <iostream>

using namespace std;

int main()
{
int n, k, x, x1, x2;
cin>>n>>k;
cin>>x;
x2=x;
for(int i=1; i<=n-1; i++)
{
    cin>>x1;
    if(x==k)
        cout<<x1<<endl;
    x=x1;
}
if(x1==k)
    cout<<x2<<endl;
}