#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace std;
using namespace __gnu_pbds;
#define INF (long long)1e18
#define MOD (long long)(1e9+7)
#define sz(x) ((int)x.size())
#define K int(12000)
#define X real()
#define Y imag()
#define F first
#define S second
#define EPS 1e-6
#define PI 3.141592
#define cross(a, b) (conj(a)*b).Y
#define MAN(a, b) norm(a-b)
#define EUC(a, b) abs(a-b)
#define PB push_back
#define REP(i, a, b) for (int i=a; i<b; i++)
#define RREP(i, a, b) for (int i=a; i>=b; i--)
#define heap priority_queue
#define endl '\n'
typedef long long ll;
typedef unsigned int ui;
typedef unsigned long long ull;
typedef unsigned short us;
typedef complex<double> point;
typedef tree<pair<int, int> , null_type, less<pair<int, int>>, rb_tree_tag,
        tree_order_statistics_node_update> indexed_set;

void solve(){
    int n, k;
    cin >> n >> k;
    int a[n], idx = -1;
    REP(i, 0, n) {
        cin >> a[i];
        if (a[i] == k) idx = i;
    }
    cout << a[(idx + 1) % n] << endl;
}

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    int t=1;// cin>>t;
    REP(i, 0, t) solve();

    return 0;
}