#include <iostream>

int main()
{
    int n, k;
    std::cin >> n >> k;
    
    int first, prev, current;
    std::cin >> first;
    current = first;
    
    for(int i = 1; i < n; i++){
        prev = current;
        std::cin >> current;
        if(prev == k){
            std::cout << current;
            return 0;
        }
    }
    
    std::cout << first;
    
    return 0;
}