#include <iostream>

using namespace std;

int main () {
	
	int niz[20005], N, K, res;
	bool flag = false;
	
	cin >> N >> K;
	
	for (int i = 0; i < N; i++) {
		
		cin >> niz[i];
		if (i == 0) res = niz[i];
		if (flag) {
			res = niz[i];
			flag = false;
		}
		if (niz[i] == K) {
			flag = true;
		}
		
	}
	
	cout << res;
		
	return 0;
}