#include <iostream>
using namespace std;

int main() {
    int n, k;
    cin >> n >> k;
    int cards[n];
    int seenIndex;
    int finalIndex = 0;
    for (int i = 0; i < n; i++)
    {
        cin >> cards[i];
    }
    for (int i = 0; i < n; i++)
    {
        if (cards[i] == k)
        {
            seenIndex = i;
            (seenIndex == (n - 1)) ? finalIndex = 0 : finalIndex = seenIndex + 1;
        }
    }
    cout << cards[finalIndex] << endl;
    return 0;
}