#include <iostream>
using namespace std;

int main(){
    int n, k, t;
    cin >> n >> k;
    int a[n];
    for(int i = 0; i < n; i++){
        cin >> a[i];
        if (a[i] == k){
            if(i == n - 1)
                t = 0;
            else
                t = i + 1;

        }
    }
    cout << a[t];
    return 0;
}