using System;

namespace Madjionicar
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] ulaz = Console.ReadLine().Split();
            int n = int.Parse(ulaz[0]);
            int k = int.Parse(ulaz[1]);
            int[] p = new int[n];
            ulaz = Console.ReadLine().Split();
            for (int i = 0; i < n; i++) p[i] = int.Parse(ulaz[i]);
            if (p[n - 1] == k) Console.WriteLine(p[0]);
            else 
            {
                for(int i = 0; i < n; i++) 
                {
                    if(p[i] == k) 
                    {
                        Console.WriteLine(p[i + 1]);
                        break;
                    }
                }
            }
        }
    }
}