using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

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