#include<stdio.h>

int main()
{
    int n, k, ind;

    int a[200000];
    scanf("%d%d", &n, &k);
    
    for(int i = 0; i < n; i++)
    {
        scanf("%d", &a[i]);
        if(a[i] == k)
            ind = (i+1)%n; 
    }

    printf("%d", a[ind]);


    return 0;
}