#include <bits/stdc++.h>
using namespace std;
const int N = 500005;
int n, k;
int a[N], p[N], nxt[N];
int main() {
  scanf("%d%d", &n, &k);
  for (int i = 0; i < n; i++) {
    scanf("%d", a + i);
    p[i] = i;
  }
  sort(p, p + n, [](int i, int j) { return a[i] < a[j]; });
  vector<int> decr;
  for (int i = n - 1; i >= 0; i--) {
    while (!decr.empty() && a[decr.back()] >= a[i]) {
      decr.pop_back();
    }
    nxt[i] = (decr.empty() ? n : decr.back());
    decr.push_back(i);
  }
  int rgt = n, bar = n;
  for (int i = 0; i < n; i++) {
    int id = p[i];
    if (bar > id + k) {
      printf("NO\n");
      return 0;
    } else if (rgt > id + k) {
      bool yes = true;
      for (int i = 0; i < id; i++) {
        if (nxt[i] - i > k) yes = false;
      }
      printf("%s\n", yes ? "YES" : "NO");
      return 0;
    } else {
      bar = min(bar, rgt - k);
      rgt = min(rgt, id);
    }
  }
  printf("YES\n");
  return 0;
}
