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

/* run this program using the console pauser or add your own getch, system("pause") or input loop */

int main(int argc, char *argv[]) {
	
	int n,i,j=0,k,br=-1;
	
	scanf("%d %d",&n,&k);
	int niz[n];
	
	for(i=0;i<n;i++){
		scanf("%d",&niz[i]);
	}
	int y,x;
	for(i=0;i<=n;i++){
		if(niz[i]==k){
			br=i;	
		}
		if(i==n){
			y=niz[0];
		}
		else if(br!=-1 && br<i){
			y=niz[i];
			break;
		}
		
	}

	printf("%d",y);
	
	
	return 0;
}