using System;

class Program {
  public static void Main (string[] args) {
    string[] s = Console.ReadLine().Split();
    int n = int.Parse(s[0]);
    int k = int.Parse(s[1]);
    string[] s1 = Console.ReadLine().Split();
    int[] niz = new int[s1.Length];
    for(int i=0;i<s1.Length;i++)
    {
      niz[i] = int.Parse(s1[i]);
    }
    if(niz[n-1]==k)
    {
      Console.WriteLine(niz[0]);
    }
    else
    {
      for(int i=0;i<n-1;i++)
      {
        if(k==niz[i])
        {
          Console.WriteLine(niz[i+1]);
          return;
        }
      } 
    }
  }
}