import java.util.Scanner;
public class     Vehicules {

    public static void main(String[] args) {
        Scanner bucky=new Scanner(System.in);
        int n=bucky.nextInt();
        int k=bucky.nextInt();
        int[] ar=new int[n];
        for(int i=0;i<n;i++) {
            ar[i]=bucky.nextInt();
        }
        int min=ar[0];
        for(int i=1;i<n;i++) {
            if(ar[i]<min)
                min=ar[i];
        }
        int a=0;
        for(int i=0;i<n;i++) {
            if(ar[i]-min>k)
                a++;
        }
        System.out.println(a);
    }   
}