#include <bits/stdc++.h>
using namespace std;
int main(){
int N,K;
cin>>N>>K;
int a[N];
for(int i=1;i<=N;i++){
    cin>>a[i];}
if(a[N]==K)
    cout<<a[1]<<endl;
else
for(int j=1;j<=N;j++){
    if(a[j]==K){
    cout<<a[j+1]<<endl;
    }}
return 0;
}