#include <stdio.h>
#include <stdlib.h>

int main()
{
    unsigned n, k;
    int i, l = -5;
    scanf("%d%d", &n, &k);
    int p[n+1];

    for(i = n; i >= 1; i--) {
        scanf("%d", &p[i]);
    }

    i = 1;
    while(l == -5) {
        if(p[i] == k)
            l = i;
        i++;
    }

    if(l == 1)
        printf("%d", p[n]);
    else
        printf("%d", p[l-1]);

    return 0;
}