#include <bits/stdc++.h>

using namespace std;

int main()
{
    ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);

    int N,K,pom,res;
    cin >> N >> K;
    bool flag = false;
    for(int i = 0;i<N;i++)
    {
        cin >> pom;

        if(flag || i == 0)
        {
            res = pom;
            flag = false;
        }
        if(pom == K)
            flag = true;

    }

    cout << res << endl;

    return 0;
}