#include <bits/stdc++.h>
using namespace std;
set<pair<int, int> > s;
int n, k, l, r, t, a[500001], f[500001];
vector<pair<int, int> > p;
int main() {
  scanf("%d%d", &n, &k);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
    s.insert(make_pair(a[i], i));
    if (i > k) {
      s.erase(make_pair(a[i - k], i - k));
      f[i - k] = (*s.begin()).first;
      if (f[i - k] >= a[i - k]) p.push_back(make_pair(a[i - k], i - k)), t++;
    }
  }
  if (!t) return printf("YES\n"), 0;
  if (p[0].second + k < p[t - 1].second + 1) return printf("NO\n"), 0;
  l = r = 2147483647;
  for (int i = 0; i < t; i++) r = min(r, p[i].first);
  for (int i = p[t - 1].second + 1; i <= p[0].second + k; i++) l = min(l, f[i]);
  if (r - l < 1) return printf("NO\n"), 0;
  for (int i = p[0].second + k; i <= n; i++)
    if (a[i] > l && a[i] < r) return printf("YES\n"), 0;
  return printf("NO\n"), 0;
}
