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

namespace ConsoleApplication43
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] i = Console.ReadLine().Split();
            int n = int.Parse(i[0]);
            int k = int.Parse(i[1]);
            string[] m = Console.ReadLine().Split();
            int[] a = new int[n];
            for(int j=0;j<n;j++)
            {

                a[j] = int.Parse(m[j]);
            }
            if(k==a[n-1])
            {
                Console.WriteLine(a[0]);
            }
            else 
            {
                for(int q=0;q<n;q++)
                {
                    if(a[q] != k)
                    {
                    }
                    else
                    {
                        Console.WriteLine(a[q + 1]);
                    }
                }
            }
            Console.ReadKey();
        }
    }
}