#include <bits/stdc++.h>

using namespace std;

int main()
{
    unsigned n, k, res;
    cin >> n >> k;
    unsigned niz [n];

    for (unsigned i = 0; i < n; i++) {
        cin >> niz [i];

        if (niz [i] == k) {
            if (i == n - 1) {
                res = niz [0];
            }
            else {
                i++;
                cin >> niz [i];
                res = niz [i];
            }
        }
    }

    cout << res;
}