#include <bits/stdc++.h>

using namespace std;

int main() {

    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);

    int n, k;
    cin >> n >> k;

    int arr[n], index = -1;
    for(int i = 0; i < n; i++) {
        cin >> arr[i];
        if(arr[i] == k)
            index = i;
    }

    cout << arr[(index + 1) % n] << endl;
    return 0;
}