#include <vector>
#include<iostream>
using namespace std;
int main()
{
    int n,k,x;
    cin>>n>>k;
    vector<int> v;
    for (int i = 0; i < n; i++)
    {
        cin>>x;
        v.push_back(x);
    }
    if(k==v[n-1])
        cout<<v[0];
    else
        for(int i=0; i<n-1; i++)
            if(v[i]==k)
                cout<<v[i+1];
    v.clear();
    return 0;
}