#include <iostream>

using namespace std;

int main()
{
    int n, k, a2;
    cin>>n>>k;
    int a;
    cin>>a;
    a2 = a;
    int a1;
    for(int i = 0; i < n - 1; i++){
        cin>>a1;
        if(a == k){
            cout<<a1;
        }
        a = a1;
    }
    if(a1 == k){
        cout<<a2;
    }
    return 0;
}