import java.util.Arrays;
import java.util.Scanner;
import java.util.ArrayList;

public class A940PointsOnTheLine {
	
	public static void main(String[] args) {
		
		Scanner sc = new Scanner(System.in);
		
		int listLength = sc.nextInt();
		int tarRange   = sc.nextInt();
		
		int total      =  0;
		int accRange   = -1; 
	
		ArrayList<Integer> list = new ArrayList<Integer>();
		int[] ist = new int[listLength];
		
		for (int i = 0; i < listLength; i++ ) {
			ist[i] = sc.nextInt();
		}
		sc.close();
		
		Arrays.sort(ist);
		
		for (int i = 0; i < listLength; i++ ) {
			list.add(ist[i]);
		}
		
		if (listLength == 1) {
			accRange = 0;
		} else {
			accRange = (list.get(list.size() - 1) - list.get(0));
		}
		while (tarRange < accRange) {
			if (listLength == 1) {
				accRange = 0;
			} else {
				// && accRange - (list.get(1) - list.get(0)) < tarRange
				if (list.get(1) - list.get(0) > list.get(list.size()-1) - list.get(list.size() - 2) ) {
					list.remove(0);
				} else {
					list.remove(list.size()-1);
					
				}
				accRange = (list.get(list.size() - 1) - list.get(0));
				total += 1;
			}	
			
		}
		System.out.println(total);
		
	}
}
