#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  long long n, k, d;
  cin >> n >> k >> d;
  multiset<long long> inA;
  multiset<long long, greater<long long>> inB;
  for (long long i = 0; i < n; i++) {
    long long x;
    cin >> x;
    inA.insert(x);
    inB.insert(x);
  }
  {
    vector<long long> minValue;
    vector<long long> count;
    long long last = -10000000000000ll;
    while (true) {
      auto it = inA.upper_bound(last + d);
      if (it == inA.end()) break;
      last = *it;
      minValue.push_back(*it);
      count.push_back(1);
      inA.erase(it);
    }
    for (long long i = 0; i < minValue.size(); i++) {
      while (count[i] < k) {
        auto it = inA.lower_bound(minValue[i] - d);
        if (it == inA.end() || abs(*it - minValue[i]) > d) {
          cout << "NO" << endl;
          return 0;
        }
        inA.erase(it);
        count[i]++;
      }
    }
  }
  {
    vector<long long> minValue;
    vector<long long> count;
    long long last = 10000000000000ll;
    while (true) {
      auto it = inB.upper_bound(last - d);
      if (it == inB.end()) break;
      last = *it;
      minValue.push_back(*it);
      count.push_back(1);
      inB.erase(it);
    }
    for (long long i = 0; i < minValue.size(); i++) {
      while (count[i] < k) {
        auto it = inB.lower_bound(minValue[i] + d);
        if (it == inB.end() || abs(*it - minValue[i]) > d) {
          cout << "NO" << endl;
          return 0;
        }
        inB.erase(it);
        count[i]++;
      }
    }
  }
  cout << "YES" << endl;
}
