
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

import static java.lang.Integer.parseInt;
import static java.util.Arrays.sort;

public class A_Points_on_the_line {
    public static void main(String[] args) throws IOException {
        BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer tk = new StringTokenizer(in.readLine());
        int n ,d;
        n = parseInt(tk.nextToken());
        d = parseInt(tk.nextToken());
        int [] ar = new int[n];
        tk = new StringTokenizer(in.readLine());
        for (int i = 0; i < n; i++) {
            ar[i] = parseInt(tk.nextToken());
        }
        sort(ar);
        int c = 0;
        for (int i = n - 1; i >= 0; --i) {
            if(ar[i] - ar[0] > d)
                c++;
        }
        System.out.println(c);;
    }
}
