#include <bits/stdc++.h>
using namespace std;

int main()
{

    long long n;
    cin >> n;
    long long prt, frst;
    long long k, l;
    cin >> k;
    bool pr = false;
    bool pr2 = false;
    cin >> frst;
    for (int i = 1; i < n; i++)
    {

        cin >> l;
        if (pr == true)
        {
            cout << l;
            pr2 = true;
            pr = false;
        }
        if (l == k && i != (n - 1))
        {
            pr = true;
        }
    }
    if (pr2 == false)
        cout << frst;

    return 0;
}