#include <bits/stdc++.h>
using namespace std;
const int N = 500005;
int n, k, a[N], nxt[N];
int q[N], id[N];
bool cmp(int x, int y) { return a[x] == a[y] ? x < y : a[x] < a[y]; }
int main() {
  scanf("%d%d", &n, &k);
  for (int i = (int)(1); i <= (int)(n); i++) scanf("%d", &a[i]);
  for (int i = (int)(1); i <= (int)(n); i++) id[i] = i;
  sort(id + 1, id + n + 1, cmp);
  int t = 1;
  q[1] = n + 1;
  a[n + 1] = -1;
  for (int i = (int)(n); i >= (int)(1); i--) {
    for (; a[q[t]] >= a[i]; --t)
      ;
    nxt[i] = q[t];
    q[++t] = i;
  }
  int px = n + 1, py = n + 1;
  for (int i = (int)(1); i <= (int)(n); i++) {
    int x = id[i];
    if (py > x + k) return puts("NO"), 0;
    if (px > x + k) {
      bool flag = 1;
      for (int j = (int)(1); j <= (int)(x - 1); j++)
        if (nxt[j] - j > k) flag = 0;
      puts(flag ? "YES" : "NO");
      exit(0);
    }
    py = min(py, px - k);
    px = min(px, x);
  }
  puts("YES");
}
