#include <iostream>

using namespace std;

int main()
{
    int n, x, r;
    cin >> n >> x;
    int a[n];
    for (int i = 0; i < n; i++)
        cin >> a[i];

    for (int i = 0; i < n - 1; i++)
    {
        if (a[i] == x)
        {
            r = a[i + 1];
            break;
        }
    }
    if (a[n - 1] == x)
        r = a[0];

    cout << r << endl;
    return 0;
}