#include <iostream>

using namespace std;

int main()
{
    int n, k,a[20005],r;
    cin >> n >> k;
    for (int i = 0; i < n; i++)
    {
        cin >> a[i];
        if (a[i] == k)r = (i + 1) % n;
    }
    cout << a[r] << endl;
}