#include <iostream>
#include <bits/stdc++.h>
using namespace std;

int main()
{
    int n,k,brojac;
    int a[30000];
    cin>>n>>k;
    for(int i=0;i<n;i++)
        {cin>>a[i];if(a[i]==k)brojac=i;}
    a[n]=a[0];
    cout <<a[brojac+1]<< endl;
    return 0;
}