#include <bits/stdc++.h>
using namespace std;
int n, K, a[500010], nxt[500010], que[500010], e, p[500010];
inline int cmp(const int &x, const int &y) { return a[x] < a[y]; }
int main() {
  scanf("%d%d", &n, &K);
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]), p[i] = i;
  sort(p + 1, p + n + 1, cmp);
  for (int i = n; i >= 1; i--) {
    while (e && a[que[e]] >= a[i]) e--;
    if (!e)
      nxt[i] = n + 1;
    else
      nxt[i] = que[e];
    que[++e] = i;
  }
  int x = n + 1, y = n + 1;
  for (int i = 1; i <= n; i++) {
    int cur = p[i];
    if (y > cur + K) {
      puts("NO");
      return 0;
    }
    if (x > cur + K) {
      bool flag = 1;
      for (int j = 1; j < cur; j++)
        if (nxt[j] - j > K) {
          flag = 0;
          break;
        }
      if (flag)
        puts("YES");
      else
        puts("NO");
      return 0;
    }
    y = min(y, x - K);
    x = min(x, cur);
  }
  puts("YES");
  return 0;
}
