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

using ll = long long;
using ld = long double;

int a[20005];

int main(){
    ios_base::sync_with_stdio(false), cin.tie(0);
    cout.precision(10);
    cout << fixed;

    int n, k;
    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] << "\n";
    return 0;
}