using System;

namespace TakmicenjeA
{
    internal class Program
    {
        static void Main(string[] args)
        {
            string[] input = Console.ReadLine().Split();
            int n = int.Parse(input[0]);
            string k = input[1];

            string[] array = Console.ReadLine().Split();

            string val = "";
            if (k == array[n - 1])
                val = array[0];
            else
            {
                for (int i = 0; i < n; i++)
                    if (array[i] == k)
                        val = array[i + 1];
            }

            Console.WriteLine(val);
        }
    }
}