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

    class Lakaka
    {
    static void Main(string[] args)
    {
        int a, b, d=0, e, g = 0, i, j, l = 0;
        float  h = 1000000, k;
        string[] s = Console.ReadLine().Split(); 
        a = int.Parse(s[0]);
        b = int.Parse(s[1]);
        string [] c = Console.ReadLine().Split();
        int[] x= new int[100000];
        for (i = 0; i < a; i++)
        {
            x[i] = int.Parse(c[i]);
        }
        for (i = 0; i < a; i++)
        {
            if (x[i] == b)
            {
                d = i + 1;
                break;
            }
        }
        if (d == a)
        {
            d = 0;
        }
        Console.WriteLine(x[d]);
    }
}