#include <bits/stdc++.h>
using namespace std;
int n, k;
const int N = 500005;
int hei[N];
int mi[N];
vector<int> only[N];
vector<int> smaller[N];
vector<int> bad;
int main() {
  ios::sync_with_stdio(0);
  cin >> n >> k;
  for (int i = 0; i < n; i++) {
    cin >> hei[i];
  }
  set<pair<int, int> > s;
  s.insert({0, n});
  for (int i = n - 1; i >= 0; i--) {
    while (s.begin()->second > i + k) s.erase(s.begin());
    while (!s.size() == 1) {
      auto it = s.begin();
      it++;
      if (it->second > i + k) s.erase(it);
    }
    vector<int> sm;
    auto it = s.begin();
    if (it->first <= hei[i]) sm.push_back(it->second);
    it++;
    if (it != s.end() && it->first <= hei[i]) sm.push_back(it->second);
    if (sm.size() == 0) bad.push_back(i);
    if (sm.size() == 1) only[sm[0]].push_back(i);
    for (int x : sm) smaller[i].push_back(x);
    mi[i] = s.begin()->first;
    s.insert({hei[i] + 1, i});
  }
  if (bad.size() == 0) {
    cout << "YES" << endl;
    return 0;
  }
  reverse(bad.begin(), bad.end());
  int toFix = bad[0] + k;
  toFix = min(n - 1, toFix);
  if (toFix < bad.back()) {
    cout << "NO" << endl;
    return 0;
  }
  int reqH = 1000000000;
  for (int x : bad) reqH = min(reqH, hei[x] - 1);
  if (mi[toFix] > reqH) {
    cout << "NO" << endl;
    return 0;
  }
  for (int i = toFix + 1; i < n; i++) {
    if (hei[i] > reqH) continue;
    if (mi[toFix] > hei[i]) continue;
    bool br = false;
    for (int x : only[i]) {
      if (i - x > k && hei[x] <= hei[toFix]) {
        br = true;
      }
    }
    if (br) break;
    cout << "YES" << endl;
    return 0;
  }
  cout << "NO" << endl;
}
