#define _CRT_SECURE_NO_WARNINGS
#include <iostream>

int main()
{
	int n, k;

	scanf("%d %d", &n, &k);	

	int first;
	int current;
	int after;
	int i = 0;

	scanf("%d", &current);
	first = current;
	while (current != k)
	{
		scanf("%d", &current);
		++i;
	}

	if (i == n - 1)
	{
		printf("%d", first);		
	}			
	else
	{
		scanf("%d", &after);

		for (int j = i + 2; j < n; ++j)
			scanf("%d", &current);

		printf("%d", after);
	}		
}