#include <bits/stdc++.h>
using namespace std;
const int MOD = 1e9 + 1;
int main()
{
    int N, K, R;
    cin >> N >> K;
    vector<int> A(N);
    bool flag = false;
    for (int i = 0; i < N; ++i)
    {
        cin >> A[i];
        if (flag)
        {
            R = A[i];
            flag = false;
        }
        if (A[i] == K)
        {
            if (i == N - 1) R = A[0];
            else flag = true;
        }
    }
    cout << R;
}