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

namespace Takmicenje
{
    internal class Program
    {
        static void Main(string[] args)
        {
            int n = 0, k = 0;
            string[] vs = Console.ReadLine().Split(' ');
            n = int.Parse(vs[0]);
            k = int.Parse(vs[1]);

            bool sledeca = false;

            string[] vs2 = Console.ReadLine().Split(' ');

            int[] br = new int[n];

            for (int i = 0; i < n; i++)
            {
                br[i] = int.Parse(vs2[i]);
            }
            
            for (int i = 0; i < n; i++)
            {
                if (sledeca)
                {
                    Console.WriteLine(br[i]);
                    break;
                }
                if (br[i] == k)
                {
                    sledeca = true;
                }
                if (sledeca && i == n - 1)
                {
                    Console.WriteLine(br[0]);
                }
            }

            Console.ReadKey();
        }
    }
}