#include <bits/stdc++.h>
using namespace std;
const int N = 5e5 + 9;
const long long mod = 998244353;
int sum[N];
void Set(int p, int val) {
  for (int i = p; i < N; i += ((i) & (-i))) sum[i] += val;
}
int Get(int p) {
  int res = 0;
  for (int i = p; i; i ^= ((i) & (-i))) res += sum[i];
  return res;
}
pair<int, int> a[N];
int main() {
  int n, k;
  scanf("%d%d", &n, &k);
  for (int i = (0); i < (n); ++i) scanf("%d", &a[i].first), a[i].second = i;
  sort(a, a + n);
  Set(1, 1);
  Set(k + 1, -1);
  int L = 0, R = n, pos = n;
  for (int i = (0); i < (n); ++i) {
    a[i].second = n - a[i].second;
    if (!Get(a[i].second)) {
      if (pos == n) pos = i;
      if (L < a[i].second - k) L = a[i].second - k;
      if (R > a[i].second - 1) R = a[i].second - 1;
    }
    Set(a[i].second, 1);
    Set(a[i].second + k + 1, -1);
  }
  if (L > R) {
    printf("NO\n");
    return 0;
  }
  if (pos == n) {
    printf("YES\n");
    return 0;
  }
  memset(sum, 0, sizeof sum);
  Set(1, 1);
  Set(k + 1, -1);
  for (int i = (0); i < (pos); ++i) {
    if (Get(L)) {
      printf("YES\n");
      return 0;
    }
    Set(a[i].second, 1);
    Set(a[i].second + k + 1, -1);
  }
  printf("NO\n");
}
