#include <iostream>

using namespace std;

int main() {
	int n, k, p, a;
	cin >> n >> k;
	for (int i = 0; i < n; i++) {
		if (i == 0) {
			cin >> p;
			a = p;
			continue;
		}
		if (a == k && i != n) {
			cin >> a;
			p = a;
			continue;
		}
		cin >> a;

	}
	cout << p;

	return 0;
}