2 1
1 1
 4 1
2 2 1 1
 10 1
2 6 3 4 2 4 4 3 2 1
 2 1
999152 999153
 8 1000000
1 1 5 1000000 1000000 2 2 2
 9 2
1 6 1 5 5 8 6 8 7
 15 1
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
 1 4
8
 10 1
6 3 1 3 6 4 1 3 6 4
 10 1
1 2 3 5 6 8 10 11 9 4
 7 2
1 5 5 8 9 8 8
 2 1000000
1 1000000
 8 2
3 13 9 8 3 13 9 14
 1 1
1
 2 1
1 2

2
 2
 4
 1
 2
 4
 15
 1
 7
 2
 4
 1
 5
 1
 1

import java.io.*;
import java.util.InputMismatchException;
import java.util.Locale;
import java.util.StringTokenizer;

public class B {
    String fileName = "<name>";

    public static class Node {
        public static int cnt = 0;
        public int l, r, sum;
        public Node leftNode, rightNode;

        public Node(int l, int r) {
            cnt++;
            this.l = l;
            this.r = r;
        }
    }

    public Node build(int l, int r) {
        Node res = new Node(l, r);
        if (l == r) {
            res.sum = 0;
        } else {
            int m = (l + r) / 2;
            Node left = build(l, m);
            Node right = build(m + 1, r);
            res.leftNode = left;
            res.rightNode = right;
        }
        return res;
    }

    public void inc(Node root, int ind) {
        if (root.l > ind || root.r < ind)
            return;
        if (root.l == root.r) {
            root.sum += 1;
        } else {
            inc(root.leftNode, ind);
            inc(root.rightNode, ind);
            root.sum = root.leftNode.sum + root.rightNode.sum;
        }
    }

    public int query(Node root, int l, int r) {
        if (r < root.l || l > root.r)
            return 0;
        if (l <= root.l && r >= root.r) {
            return root.sum;
        }
        return query(root.leftNode, l, r) + query(root.rightNode, l, r);
    }

    public void solve() throws IOException {
        FastScanner sc = new FastScanner(System.in);
        int n = sc.nextInt();
        int k = sc.nextInt();
        Node root = build(0, (int) 1e6 + 20);
        Integer[] a = new Integer[n];
        for (int i = 0; i < n; i++) {
            a[i] = sc.nextInt();
            inc(root, a[i]);
        }
        int cnt = 0;
        for (int i = 0; i < n; i++) {
            if (query(root, a[i] + 1, a[i] + k) > 0) {
                cnt++;
            }
        }
        out.print(n - cnt);
    }

    public void run() {
        try {
            br = new BufferedReader(new InputStreamReader(System.in));
            out = new PrintWriter(System.out);

            solve();

            out.close();
        } catch (IOException e) {
            e.printStackTrace();
            System.exit(1);
        }
    }

    static class FastScanner extends BufferedReader {
        public FastScanner(InputStream is) {
            super(new InputStreamReader(is));
        }


        public int read() {
            try {
                return super.read();
            } catch (IOException e) {
                throw new InputMismatchException();
            }
        }

        static boolean isWhiteSpace(int c) {
            return c >= 0 && c <= 32;
        }

        public int nextInt() {
            int c = read();
            while (isWhiteSpace(c)) {
                c = read();
            }
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            int ret = 0;
            while (c >= 0 && !isWhiteSpace(c)) {
                ret = ret * 10 + c - '0';
                c = read();
            }
            return ret * sgn;
        }

        public String readLine() {
            try {
                return super.readLine();
            } catch (IOException e) {
                return null;
            }
        }

    }


    BufferedReader br;
    StringTokenizer in;
    PrintWriter out;

    public String nextToken() throws IOException {
        while (in == null || !in.hasMoreTokens()) {
            in = new StringTokenizer(br.readLine());
        }
        return in.nextToken();
    }

    public int nextInt() throws IOException {
        return Integer.parseInt(nextToken());
    }

    public double nextDouble() throws IOException {
        return Double.parseDouble(nextToken());
    }

    public long nextLong() throws IOException {
        return Long.parseLong(nextToken());
    }

    public static void main(String[] args) throws IOException {
        Locale.setDefault(Locale.US);
        new B().run();
    }
}