#include <iostream>
#include <vector>
using namespace std;

int main() {
    int n, k;
    cin >> n >> k;
    vector<int> a(n);
    for (int i = 0; i < n; i++) {cin >> a[i];}
    for (int i = 0; i < n; i++) {
        if (k == a[i]) {
            if (i != n - 1) cout << a[i + 1];
            if (i == n - 1) cout << a[0];
            return 0;
        }
    }
}