#include <iostream>
#include <vector>
#include <numeric>
#include <sstream>
#include <cstdlib>
#include <string>
#include <algorithm>
#include <cmath>
#include <iterator>
#include <map>
#include <climits>
#define watch(x) cout << (#x) << " is " << (x) << endl

using namespace std;
typedef long long ll;


int main()
{
    ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	int n, k, r, r0, rr;
	r = -1;
	cin>>n>>k;
	cin>>r0;
	if(r0 == k)
    {
        int t;
        cin>>t;
        cout<<t;
    }
    else
    {
        for(int i = 1; i < n; ++i)
        {
            int x;
            cin>>x;
            if(x == k)
            {
                if(i == n-1)
                    r = 0;
                else
                    break;
            }
        }
        if(r == 0)
            cout<<r0;
        else
        {
            cin>>rr;
            cout<<rr;
        }
    }

}