using System;
namespace _1._zad_18._12
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] unos = Console.ReadLine().Split();
                int n = int.Parse(unos[0]);
            int k = int.Parse(unos[1]);
            int[] niz = new int[n];
            string[] unos2 = Console.ReadLine().Split();
       
            for (int i = 0; i < n; i++)
            {
                niz[i] = int.Parse(unos2[i]);
                if (niz[i] == k && i != n - 1)
                {
                    Console.WriteLine(unos2[i + 1]);
                    break;
                }
                else if (niz[i] == k && i == n - 1)
                {
                    Console.WriteLine(unos2[0]);
                    break;
                }
            }

        }
    }
}