#include<bits/stdc++.h>
#define ll long long
#define pb push_back
#define ff first
#define ss second
#define mp make_pair
#define sz(x) (int)(x).size()
#define all(x) x.begin(), x.end()
using namespace std;

const char nl='\n';
const int MOD=1000000007;
const int N=200005;

int n,k,a[N];

void solve(){
    cin>>n>>k;
    for(int i=1;i<=n;i++){
        cin>>a[i];
    }
    a[n+1]=a[1];
    for(int i=1;i<=n;i++){
         if(a[i]==k){
            cout<<a[i+1]<<nl;
            break;
         }
    }
}
int main () {
cin.tie(NULL);
ios_base::sync_with_stdio(false);

int T=1;
//cin>>T;
while(T--){
    solve();
}

return 0;
}