using System;
using System.Diagnostics;
using System.Collections.Generic;

namespace Madionicar
{
    internal class Program
    {
        static void Main(string[] args)
        {
            string prva = Console.ReadLine();
            string druga = Console.ReadLine();
            int br_karti = int.Parse(prva.Split()[0]);
            int br_karte = int.Parse(prva.Split()[1]);
            List<int> br = new List<int>();
            int index=0;
            for (int i = 0; i < br_karti; i++)
            {
                br.Add(int.Parse(druga.Split()[i]));
                if (br[i] == br_karte && i != br_karti - 1)
                    index += i + 1;
            }
            Console.WriteLine(br[index]);
        }
    }
}