import java.util.* ;
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class A {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int si,lim,i;
		si = sc.nextInt() ;
		lim = sc.nextInt() ;
		int[] arr = new int[si] ;
		//boolean[] a = new boolean[si]
		for(i=0;i<si;i++) {
			arr[i] = sc.nextInt() ;
		}
		Arrays.sort(arr);
		for(i=1;i<si;i++) {
			if(arr[i] - arr[0] > lim) {
				break ;
			}
		}
		//System.out.println(i);
		System.out.println(si-i);
	}
}