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

namespace Madjionicar
{
    internal class Program
    {
        static void Main(string[] args)
        {

            string[] nk = Console.ReadLine().Split();
            
            string[] arr = Console.ReadLine().Split();

            if (nk[1] == arr[int.Parse(nk[0]) - 1])
            {
                Console.WriteLine(arr[0]);
            }
            else
            {

                for (int i = 0; i < int.Parse(nk[0]); i++)
                {




                    if (nk[1] == arr[i])
                    {
                        Console.WriteLine(arr[i + 1]);
                        break;
                    }

                }

            }


        }
    }
}