#include <iostream>
using namespace std;

int main()
{
    int n,k,tmp,tmp2;
    cin>>n>>k;
    int karte[n];
    cin>>tmp;
    if(tmp==k)
       {
           cin>>tmp2;
           cout<<tmp2;
        return 0;

       }

    for(int i=1;i<n;i++)
    {
       cin>>tmp2;
       if(tmp2==k && i!=n-1)
       {
           cin>>tmp2;
           cout<<tmp2;
           return 0;


       }
       else if(tmp2==k && i==n-1)
       {
           cout<<tmp;
           return 0;
       }
    }
}