#include <bits/stdc++.h>
	#define ll unsigned long long
	
	using namespace std;
	
	int main() {
	    ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
	   ll n, k;
	   cin >> n >> k;
	   ll u[n + 1], t;
	   for(ll i = 0; i < n; i++) {
	   	cin >> u[i];
	   	if(u[i] == k) t = i;
	   }
	   u[n] = u[0];
	   cout << u[t + 1];
	    return 0; 
	}