#include <bits/stdc++.h>
using namespace std;
int n, k, nums[1000010];
int M[1000010][25], LOG[1000010];
void process(int siz) {
  for (int i = 0; i <= siz; i++) M[i][0] = i;
  for (int j = 1; (1 << j) <= siz; j++)
    for (int i = 1; i + (1 << j) - 1 <= siz; i++) {
      if (nums[M[i][j - 1]] < nums[M[i + (1 << (j - 1))][j - 1]]) {
        M[i][j] = M[i][j - 1];
      } else {
        M[i][j] = M[i + (1 << (j - 1))][j - 1];
      }
    }
}
void init() {
  for (int i = 0, ret = 0; i < 1000010; i++)
    LOG[i] = ret += (i > 1 && !(i & (i - 1)));
}
int query(int i, int j) {
  int k = LOG[j - i + 1];
  return min(nums[M[i][k]], nums[M[j - (1 << k) + 1][k]]);
}
int need[1000010];
int main() {
  scanf("%d %d", &n, &k);
  for (int i = 1; i <= n; i++) scanf("%d", &nums[i]);
  init();
  process(1000010 - 5);
  for (int i = 1; i <= n; i++) need[i] = query(i + 1, i + k) + 1;
  vector<int> wrong;
  wrong.push_back(0);
  for (int i = 1; i <= n; i++)
    if (nums[i] < need[i]) wrong.push_back(i);
  if (wrong.size() == 1)
    printf("YES\n");
  else {
    int x = 1000000001;
    for (int i = 1; i < (int)wrong.size() - 1; i++) x = min(x, nums[wrong[i]]);
    for (int i = wrong[(int)wrong.size() - 2] + 1; i < wrong.back(); i++) {
      if (nums[i] > nums[wrong.back()] && nums[i] >= need[wrong.back()] &&
          nums[wrong.back()] >= need[i]) {
        if (i - wrong[1] <= k && nums[wrong.back()] < x) {
          printf("YES\n");
          return 0;
        }
      }
    }
    x = min(x, nums[wrong.back()]);
    set<int> aux;
    for (int i = wrong[1] + k + 1; i <= n; i++) aux.insert(nums[i]);
    for (int i = wrong[1] + k; i > wrong.back(); i--) {
      if (aux.lower_bound(need[i]) != aux.end()) {
        if (*aux.lower_bound(need[i]) < x &&
            nums[i] > *aux.lower_bound(need[i])) {
          printf("YES\n");
          return 0;
        }
      }
      aux.insert(nums[i]);
    }
    printf("NO\n");
  }
  return 0;
}
