#include <iostream>
using namespace std;
int main() {
	
	int n, k;
	int a[20000];
	int rez;
	cin >> n >> k;
	
	for(int i = 0; i < n; i++)
	{
		cin >> a[i];
		if(a[i] == k)
		{
			if(i == n - 1)
			{
				rez = 0;
			}
			else
			{
				rez = i + 1;
			}
		}
	}
	cout << a[rez];
	
	return 0;
}