#include <iostream>
#include <string>
#include <vector>

int main () {
    int n, k, r;
    std::cin >> n >> k;
    std::vector<int> a;
    for (int i = 0; i < n; i++) {
        int t;
        std::cin >> t;
        if (t == k) {
            r = i;
        }
        a.push_back(t);
    }
    int res = (r+1)%a.size();
    std::cout << a[res] << std::endl;
    /*for (int i = 0; i < n-1; i++) {
        std::vector<int> newa;
        for (int j = i; j < a.size(); j++) {
            newa.push_back(a[j]);
        }
        for (int j = 0; j < i; j++) {
            newa.push_back(a[j]);
        }
        for (int j = 0; j < a.size(); j++) {
            std::cout << newa[j] << " ";
        }
        std::cout << std::endl;
    }*/
    int rg = 3 >> 2 >> 2;
}