
import java.math.BigInteger;
import java.util.Arrays;
import java.util.Scanner;

public class Main {


    public static void main(String[] args) {

        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int d  = scanner.nextInt();
        int counter = 0, current_num;
        int array[] = new int[n];
        int min = Integer.MAX_VALUE;

        for (int i = 0; i < n; i++) {
            array[i] = scanner.nextInt();
            min = Math.min(min, array[i]);

        }
        for (int i = 0; i < n; i++) {
            if (array[i] - min > d)
                counter++;
        }
        System.out.println(counter);

    }
}

