#include <bits/stdc++.h>
using namespace std;
const int oo = 0x3f3f3f3f;
const long long ooo = 9223372036854775807ll;
const int _cnt = 1000 * 1000 + 7;
const int _p = 1000 * 1000 * 1000 + 7;
const int N = 500105;
const double PI = acos(-1.0);
const double eps = 1e-9;
int o(int x) { return x % _p; }
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
int lcm(int a, int b) { return a / gcd(a, b) * b; }
void file_put() {
  freopen("filename.in", "r", stdin);
  freopen("filename.out", "w", stdout);
}
int n, k, a[N], num[N], pos[N], m = 0, tt = 0;
int main() {
  scanf("%d%d", &n, &k);
  for (int i = (1); i <= (n); ++i) scanf("%d", &a[i]);
  a[n + 1] = 0;
  num[++m] = 1, pos[1] = m;
  for (int i = (1); i <= (n + 1); ++i) {
    if (a[i] >= a[num[m]]) continue;
    num[++m] = i;
    pos[i] = m;
  }
  for (int i = (2); i <= (m); ++i) {
    if (num[i] - num[i - 1] > 2 * k) return 0 * printf("NO\n");
    if (num[i] - num[i - 1] <= k) continue;
    if (tt) return 0 * printf("NO\n");
    tt = i;
  }
  if (!tt) return 0 * printf("YES\n");
  if (tt < m && num[tt + 1] - num[tt - 1] <= 2 * k) return 0 * printf("YES\n");
  for (int i = (num[tt] + 1); i <= (n); ++i) {
    if (a[i] >= a[num[tt - 1]] || a[i] <= a[num[tt]]) continue;
    if (pos[i] && num[pos[i + 1]] - num[pos[i - 1]] <= k)
      return 0 * printf("YES\n");
    if (!pos[i]) return 0 * printf("YES\n");
  }
  printf("NO\n");
  return 0;
}
