#include <bits/stdc++.h>
using namespace std;
const int N = 5e5 + 100;
int num[N];
bool vis[N];
vector<int> v;
int n, k;
int main() {
  scanf("%d %d", &n, &k);
  int mn = 1e9 + 100;
  for (int i = 1; i <= n; i++) {
    scanf("%d", &num[i]);
    if (num[i] < mn) {
      mn = num[i];
      vis[i] = true;
      v.push_back(i);
    }
  }
  v.push_back(n + 1);
  num[n + 1] = 0;
  int cnt = 0;
  int mx = 0;
  for (int i = 1; i < v.size(); i++) {
    mx = max(mx, v[i] - v[i - 1]);
    if (v[i] - v[i - 1] > k) cnt++;
  }
  if (cnt >= 2) {
    puts("NO");
  } else if (cnt == 0) {
    puts("YES");
  } else {
    int tmp = -1;
    for (int i = 1; i < v.size(); i++) {
      if (v[i] - v[i - 1] > k) tmp = i;
    }
    bool ans = false;
    if (tmp != v.size() - 1 && v[tmp + 1] - v[tmp - 1] <= 2 * k) ans = true;
    if (tmp == 0 && v[1] <= 2 * k) tmp = true;
    for (int i = v[tmp] + 1; i <= n; i++) {
      if (vis[i]) continue;
      if (num[i] < num[v[tmp - 1]] && num[i] > num[v[tmp]]) ans = true;
    }
    if (ans)
      puts("YES");
    else
      puts("NO");
  }
  return 0;
}
