#include <bits/stdc++.h>

using namespace std;

int main()
{
    int n,k;
    cin>>n>>k;
    int nizic[n];
    for(int i=0;i<n;i++)
    {
        cin>>nizic[i];
        if(nizic[i]==k and i==n-1)
        {
            cout<<nizic[0];
        }else{
            if(nizic[i]==k)
            {
                cin>>nizic[i+1];
                cout<<nizic[i+1];
                i++;
            }
        }
    }

    return 0;
}