#include <bits/stdc++.h>

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];

    if(k == a[n - 1])
        cout << a[0] << endl;

    else {
        for(int i = 0; i < n; i++)
            if(k == a[i])
                cout << a[i + 1] << endl;
    }

    return 0;
}