#include <iostream>
#include<bits/stdc++.h>
using namespace std;
#define ll long long 
#define endl "\n"

int main(){

	ios_base::sync_with_stdio(false);
	cin.tie(NULL);cout.tie(NULL);
	int n =0 , m = 0;
	cin >> n >> m ;
	if(min(m , n ) + 3 > max(m,n ) ){
		cout <<"Yes" <<endl;}
	else
		cout << "No" <<endl;
		

return 0;}

#include <iostream> 
#include <algorithm>
#include <vector>
//#include <string>
//#include <set>
#include <map>
//#include <math.h>
//#include <queue>
//#include <tuple>
//#include <iomanip>
//#include <numeric>
using ll = long long;
using ld = long double;
using namespace std;
#define rep(i,n) for (int i=0;i<(int)(n);i++)
//const ll INF = numeric_limits<ll>::max()/4;
int main () {
    map<int, vector<int>> pos;
    int N, M;
    cin >> N >> M;
    rep(i,N) {
        int a;
        cin >> a;
        pos[a].push_back(i);
    }
    rep(i,N+1) {
        int l = -1;
        for(auto r: pos[i]) {
            if (r-l-1 >= M) {cout << i << endl; return 0;}
            l = r;
        }
        if (N-l-1 >= M) {cout << i << endl; return 0;}
    }
    return 0;
}