#include <iostream>
using namespace std;
int a[20000];

int main()
{
    int n, k; cin >> n >> k;
    int i;
    for (i = 0; i < n - 1; i++)
    {
         cin >> a[i];
         if (a[i] == k) {
             cin >> a[++i];
             cout << a[i] << endl;
             break;
         }
    }
    if (i == n - 1) {
        cin >> a[i];
        if (a[i] == k) cout << a[0] << endl;
    }
    return 0;
}