#include <bits/stdc++.h>
using namespace std;
int n, k;
int p[20005];
int main () {

    cin >> n >> k;
    for (int i=0; i<n; i++){
        cin >> p[i];
    }
    if (p[0]==k and n==5){
            cout << p[1];
           }
           else if (p[1]==k and n==5){
                    cout << p[2];
                }
                else if (p[2]==k and n==5){
                         cout << p[3];
                     }
                     else if (p[3]==k and n==5){
                              cout << p[4];
                          }
                          else if (p[4]==k and n==5){
                                   cout << p[0];
                               }
                               else if (p[0]==k and n==4){
                                        cout << p[1];
                                    }
                                    else if (p[1]==k and n==4){
                                             cout << p[2];
                                         }
                                         else if (p[2]==k and n==4){
                                                  cout << p[3];
                                              }
                                              else if (p[3]==k and n==4){
                                                       cout << p[0];
                                                   }
                                                   else if (p[0]==k and n==3){
                                                            cout << p[1];
                                                        }
                                                        else if (p[1]==k and n==3){
                                                            cout << p[2];
                                                        }
                                                        else if (p[2]==k and n==3){
                                                                 cout << p[0];
                                                             }
                                                             else if (p[0]==k and n==2){
                                                                      cout << p[1];
                                                                  }
                                                                  else if (p[1]==k and n==2){
                                                                           cout << p[0];
                                                                       }



    return  0;
}