#include <bits/stdc++.h>
//#include <stdio.h>
//#include <stdlib.h>
//#include <assert.h>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
#pragma GCC optimize("O3,unroll-loops")
#pragma GCC target("avx2,bmi2,popcnt,lzcnt")
#define ve vector
#define pb push_back
#define ins insert
#define be begin()
#define en end()
#define f first
#define s second
#define ll long long
//#define double long double
using namespace std;
//using namespace __gnu_pbds;
//template<class T> using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
int n,r,x;
ve<int>b[202000],c[202000];
int gt(ve<int>a){
for(int i = 0; i < n; i++){
b[i+1].clear();
c[i+1].clear();
b[i+1].pb(a[i*2]);
b[i+1].pb(a[i*2+1]);
}
for(int ti = 0; ti < r; ti++){
if(clock()>1450){
return 1e9;
}
for(int i = 2; i <= n; i++){
c[i-1].pb(min(b[i][0],b[i][1]));
c[i].pb(max(b[i][0],b[i][1]));
}
c[1].pb(min(b[1][0],b[1][1]));
c[n].pb(max(b[1][0],b[1][1]));
for(int i = 1; i <= n; i++){
b[i][0]=c[i][0];
b[i][1]=c[i][1];
c[i].clear();
}
}
for(int i = 1; i <= n; i++){
if(b[i][0]==x||b[i][1]==x)
return i;
}
return n;
}
void solve(){
cin >> n >> r;
r=2*n+((r-2*n)%n);
ve<int>a;
cin >> x;
for(int i = 0; i < n*2-1; i++){
int a1;
cin >> a1;
a.pb(a1);
}
int mn=1e9,p=n;
for(int i = n*2-1; i >=0; i-=2){
ve<int>d;
for(int j = 0; j < i; j++)
d.pb(a[j]);
d.pb(x);
for(int j = i; j < a.size(); j++)
d.pb(a[j]);
int g = gt(d);
if(g<mn){
mn = g;
p=i/2+1;
if(p==1)
break;
}
if(clock()>1450)
break;
}
cout << p << '\n';
}
int32_t main(){
ios_base::sync_with_stdio(0);
cin.tie(0); cout.tie(0);
int t=1;
// cin >> t;
while(t--)
solve();
}