#include <iostream>

using namespace std;

int main()
{
    int n,k, pozk;
    cin >> n >> k;
    int a[n];
    for(int i = n-1;i >= 0;i--){
        cin >> a[i];
        if(a[i] == k)
        pozk = i;
    }
    if(pozk == 0)
        cout << a[n-1];
    else cout << a[pozk - 1];
    return 0;
}