#include<bits/stdc++.h>
using namespace std;
int n,k,niz[20005];
int main(){
    cin>>n>>k;
    for(int i=1;i<=n;i++){
        cin>>niz[i];
    }
    if(niz[n]==k) cout<<niz[1]<<endl;
    for(int i=1;i<=n;i++){
        if(niz[i]==k and niz[i]!=niz[n]) cout<<niz[i+1]<<endl;
    }
return 0;
}