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

namespace Madjionicar
{
    class Program
    {
        static void Zameni(ref int a, ref int b)
        {
            int p = a;
            a = b;
            b = p;
        }


        static int Karta(int k, int[] a)
        {
            int pozk = 0;
            int n = 0;
            if (a.Length == 2)
            {
                if (a[0] != k)
                {
                    return  a[1];
                }
            }
            else
            {
                for (int i = 0; i < a.Length - 2; i++)
                {
                    Zameni(ref a[i], ref a[i + 2]);
                    for (int j = a.Length / 2 + 1; j > 0; j--)
                    {
                        Zameni(ref a[j], ref a[i]);
                    }
                }

                for (int i = 0; i < a.Length; i++)
                {
                    if (a[i] == k)
                    {
                        pozk = i;
                    }
                }
                
            }
            //return a;
            //return trazena;
            return a[pozk + 1];
        }


        static void Main(string[] args)
        {

            int n, k;
            string[] s = Console.ReadLine().Split();
            n = int.Parse(s[0]);
            k = int.Parse(s[1]);

            int[] a = new int[n];

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

            for (int i = 0; i < n; i++)
            {
                a[i] = int.Parse(e[i]);
            }

            Console.WriteLine(Karta(k, a));

            Console.ReadKey();
        }
    }
}