#include<bits/stdc++.h>
using namespace std;

int main(){
	long long n,k,res,x,first;
	bool chk;
	chk = false;
	//long long niz[];
	cin >> n >> k;
	for (int i = 0; i < n; i++) {
		cin >> x;
		if (i == 0) first = x;
		if ( chk ){
		res = x;
		chk = false;
		}	
		if ( x == k ) chk = true;
	}
	if (chk) res = first;

 	cout << res << "\n";
	return 0;
}