#include <bits/stdc++.h>

int niz[20005];

int main()
{
    int n, k;

    scanf("%d %d", &n, &k);

    int result = -1;
    for(int i = 0; i < n; i++)
    {
        scanf("%d", &niz[i]);

        if(niz[i] == k)
            result = (i + 1) % n;
    }

    printf("%d", niz[result]);

    return 0;
}