#include <iostream>

using namespace std;

int main()
{
    int n, k;
    cin >> n >> k;
    int arr[n];
    int p;
    for(int i = 0; i < n; i++)
    {
        cin >> arr[i];
        if(arr[i] == k)
        {
            p = i;
        }
    }
    if(p == (n-1))
    {
        p = -1;
    }
    cout << arr[p+1];
}