import java.util.*;
import java.util.Arrays;
 public class c{
    public static void main (String [] args){
        Scanner sc = new Scanner (System.in);
        int  n = sc.nextInt();
        int k = sc.nextInt ();
        int [] arr = new int [n];
        for (int i = 0; i <n; i++)
            arr [i ] = sc.nextInt();
        Arrays.sort(arr);
        int t = 0;
        int p = 0;
        for (int i = 0; i < n; i++){
            for (int j = i+1; j < n ; j ++){
            if  (j+p>=n)
                continue;
            else  if( ((arr[j+p])- arr[i]) <= k)      
                t = t+1;
            else {
                
                continue;}
            }
            p = t;
        }
        if (n == 1)
             System.out.println(0);
        else System.out.println(n-t-1);
    }
}