4 2 12
10 16 22 28
 10 3 1
5 5 5 6 6 7 8 8 8 9
 8 7 13
52 85 14 52 92 33 80 85
 10 5 293149357
79072863 760382815 358896034 663269192 233367425 32795628 837363300 46932461 179556769 763342555
 10 3 0
1 1 2 2 2 2 2 2 2 2
 10 4 28
5 5 6 6 30 30 32 33 50 55
 6 2 1
1 1 2 3 4 5
 6 3 3
1 1 1 1 1 5
 4 2 1
1 1 2 3
 6 3 2
1 2 3 3 4 5
 5 2 3
8 9 11 12 16
 10 3 3
1 1 2 4 5 6 9 10 11 12
 6 3 3
2 2 2 4 7 7
 3 2 257816048
1 999999999 999999999
 6 3 2
1 2 2 3 4 5
 9 3 2
1 2 2 3 4 5 6 7 7
 4 2 100
1 2 3 200
 7 3 3
6 8 9 10 12 13 14
 10 3 3
1 2 3 3 3 3 3 3 3 5
 10 4 9
47 53 33 48 35 51 18 47 33 11
 13 2 86
841 525 918 536 874 186 708 553 770 268 138 529 183
 7 3 3
1 2 4 6 7 8 10
 10 3 3
1 1 1 2 2 5 6 7 8 9
 6 2 2
1 2 3 4 6 7
 9 3 3
1 2 3 4 5 6 7 8 9
 18 2 86
665 408 664 778 309 299 138 622 229 842 498 389 140 976 456 265 963 777
 10 4 1
2 2 2 3 3 10 10 10 11 11
 3 2 76
44 5 93
 6 3 3
1 2 3 4 5 6
 8 4 5
1 1 1 1 1 9 9 9
 12 3 2
1 2 3 9 10 11 12 13 14 15 15 15
 8 3 6
1 2 3 3 4 7 11 11
 6 3 3
1 2 3 4 7 8
 10 4 15
20 16 6 16 13 11 13 1 12 16
 4 2 3
1 2 3 6
 7 3 3
1 1 3 4 4 4 7
 6 3 3
1 1 4 3 3 6
 6 3 4
1 2 3 4 6 7
 8 2 3
1 2 3 4 10 11 12 13
 6 2 2
2 3 4 5 6 8
 8 3 3
1 1 1 2 2 3 3 5
 18 3 1
1 1 1 2 2 3 5 5 5 6 6 7 9 9 9 10 10 11
 1 1 1
1
 16 2 2
3 3 3 4 5 6 7 9 33 33 33 32 31 30 29 27
 4 2 4
9 1 2 3
 3 2 2
6 7 7
 5 2 7
1 3 4 5 10
 5 2 9
3 8 9 14 20
 3 2 15
1 18 19
 5 2 3
1 2 3 4 100
 14 2 75
105 300 444 610 238 62 767 462 17 728 371 578 179 166
 7 3 3
1 2 3 4 4 5 5
 10 4 7
4 3 6 5 4 3 1 8 10 5
 6 3 4
1 1 3 5 8 10
 7 2 2
1 2 3 4 5 6 7
 15 8 57
40 36 10 6 17 84 57 9 55 37 63 75 48 70 53
 11 3 4
1 1 1 5 5 5 10 12 14 16 18
 8 3 6
1 2 3 3 7 4 11 11
 6 4 0
1 3 2 4 2 1
 5 2 3
5 7 7 7 10
 9 3 1
1 2 2 2 2 3 4 4 5
 11 3 1
1 1 2 2 3 3 3 4 4 5 5

YES
 YES
 NO
 NO
 NO
 YES
 YES
 NO
 YES
 YES
 NO
 YES
 YES
 NO
 YES
 YES
 NO
 NO
 YES
 NO
 YES
 NO
 YES
 YES
 YES
 YES
 YES
 NO
 YES
 NO
 YES
 YES
 NO
 YES
 YES
 YES
 YES
 YES
 YES
 YES
 YES
 YES
 YES
 YES
 NO
 YES
 YES
 YES
 NO
 NO
 YES
 YES
 YES
 NO
 YES
 NO
 NO
 YES
 NO
 YES
 YES
 YES

import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.InputMismatchException;
import java.io.IOException;
import java.util.TreeSet;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author ankur
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskA solver = new TaskA();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskA {
        int[] fenwick;

        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int n = in.nextInt();
            int k = in.nextInt();
            int d = in.nextInt();
            int ar[] = in.nextIntArray(n);
            ar = in.arrayssort(ar);
            fenwick = new int[(int) (2 * 1e6)];
            TreeSet<pair> tr = new TreeSet<>();
            for (int i = 0; i < n; i++) {
                tr.add(new pair(i, ar[i]));
            }
            update(1, n + 1);
            for (int i = n - 1; i >= 0; i--) {
                int j = i + k;
                pair last = tr.floor(new pair(n + 1, ar[i] + d));
                //   System.out.println(i+" "+last.ind+" "+last.val);
                int l = last.ind + 1;
                if (j > l) {
                    continue;
                }
                //  System.out.println(j+" cac"+i);
                int val = query(l + 1) - query(j);
                if (val > 0) {
                    update(1, i + 1);
                }
            }
            if (query(1) > 0) {
                out.print("YES");
            } else {
                out.print("NO");
            }

        }

        void update(int val, int idx) {
            while (idx < 1e6) {
                fenwick[idx] += val;
                idx = idx + (idx & -idx);
            }
        }

        int query(int idx) {
            int ans = 0;
            while (idx > 0) {
                ans += fenwick[idx];
                idx = idx - (idx & (-idx));
            }
            return ans;
        }

        class pair implements Comparable<pair> {
            int ind;
            int val;

            pair(int i, int v) {
                ind = i;
                val = v;
            }

            public int compareTo(pair o) {
                if (this.val == o.val)
                    return this.ind - o.ind;
                return this.val - o.val;
            }

        }

    }

    static class InputReader {
        private final InputStream stream;
        private final byte[] buf = new byte[8192];
        private int curChar;
        private int snumChars;

        public InputReader(InputStream st) {
            this.stream = st;
        }

        public int read() {
            //*-*------clare------
//remeber while comparing 2 non primitive data type not to use ==
//remember Arrays.sort for primitive data has worst time case complexity of 0(n^2) bcoz it uses quick sort
//again silly mistakes ,yr kb tk krta rhega ye mistakes
//try to write simple codes ,break it into simple things
//knowledge>rating
        /*
        public class Main
        implements Runnable{
    public static void main(String[] args) {
        new Thread(null,new Main(),"Main",1<<26).start();

    }
    public void run() {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskC solver = new TaskC();//chenge the name of task
        solver.solve(1, in, out);
        out.close();
    }
         */

            if (snumChars == -1)
                throw new InputMismatchException();
            if (curChar >= snumChars) {
                curChar = 0;
                try {
                    snumChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (snumChars <= 0)
                    return -1;
            }
            return buf[curChar++];
        }

        public int nextInt() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            int res = 0;
            do {
                res *= 10;
                res += c - '0';
                c = read();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        public int[] nextIntArray(int n) {
            int a[] = new int[n];
            for (int i = 0; i < n; i++) {
                a[i] = nextInt();
            }
            return a;
        }

        public int[] arrayssort(int[] ar) {
            Integer arr[] = new Integer[ar.length];
            for (int i = 0; i < ar.length; i++)
                arr[i] = ar[i];
            Arrays.sort(arr);
            int ans[] = new int[ar.length];
            for (int i = 0; i < ar.length; i++) {
                ans[i] = arr[i];
            }
            return ans;
        }

        public boolean isSpaceChar(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

    }
}

