#include <bits/stdc++.h>
using namespace std;
bool debug = 0;
int n, m, k;
int dx[4] = {0, 1, 0, -1}, dy[4] = {1, 0, -1, 0};
string direc = "RDLU";
long long ln, lk, lm;
void etp(bool f = 0) {
  puts(f ? "YES" : "NO");
  exit(0);
}
void addmod(int &x, int y, int mod = 1000000007) {
  assert(y >= 0);
  x += y;
  if (x >= mod) x -= mod;
  assert(x >= 0 && x < mod);
}
void et() {
  puts("-1");
  exit(0);
}
long long fastPow(long long x, long long y, int mod = 1000000007) {
  long long ans = 1;
  while (y > 0) {
    if (y & 1) ans = (x * ans) % mod;
    x = x * x % mod;
    y >>= 1;
  }
  return ans;
}
long long gcd1(long long x, long long y) {
  long long z = y;
  while (x % y != 0) {
    z = x % y;
    x = y;
    y = z;
  }
  return z;
}
int nxt[500105], a[500105];
vector<pair<int, int> > vp, vv;
void fmain(int ID) {
  scanf("%d%d", &n, &k);
  for (int(i) = 1; (i) <= (int)(n); (i)++) scanf("%d", a + i);
  vv.push_back({-1, n + 1});
  for (int i = n; i; i--) {
    while (vv.back().first >= a[i]) vv.pop_back();
    nxt[i] = vv.back().second;
    vv.push_back({a[i], i});
    vp.push_back({a[i], i});
  }
  sort(vp.begin(), vp.end());
  for (int i = 0, x = n + 1, y = n + 1; i < n; i++) {
    int id = vp[i].second;
    if (id + k < y) etp();
    if (id + k < x) {
      for (int j = 1; j < id; j++) {
        if (nxt[j] - j > k) etp();
      }
      etp(1);
    }
    y = min(y, x - k);
    x = min(x, id);
  }
  etp(1);
}
int main() {
  int t = 1;
  for (int(i) = 1; (i) <= (int)(t); (i)++) {
    fmain(i);
  }
  return 0;
}
