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


public class ProblemA {
  public static void main(String[] args)throws IOException{
    BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
    String[] strs = reader.readLine().split(" ");
    int n = Integer.parseInt(strs[0]);
    int d = Integer.parseInt(strs[1]);
    strs = reader.readLine().split(" ");
    int[] nums = new int[n];
    for(int i = 0; i < n; i++){
      nums[i] = Integer.parseInt(strs[i]);
    }
    int[] problems = new int[n];
    int res = 0;
    while(true){
      for(int i = 0; i < nums.length; i++){
        if(problems[i] == -1){
          continue;
        }
        for(int j = i+1; j < nums.length; j++){
          if(problems[j] == -1){
            continue;
          }
          if(Math.abs(nums[i] - nums[j]) > d){
            problems[i]++;
            problems[j]++;
          }
        }
      }

      int index = -1;
      int max = -1;
      for(int i = 0; i < nums.length; i++){
        if(problems[i] > 0 && problems[i] > max){
          max = problems[i];
          index = i;
        }
      }
      if(index == -1){
        break;
      }
      problems[index] = -1;
      res++;
      for(int i = 0; i < n; i++){
        if(problems[i] != -1){
          problems[i] = 0;
        }
      }
    }
    System.out.println(res);
  }
}
