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

public class A940PointsOnTheLine {
	public static int RecPoints(ArrayList<Integer> list, int total, int tarRange) {
		if (list.size() == 1) {
			return total;
		} else {
			
			int fst = list.get(0);
			int snd = list.get(1);
			int pen = list.get(list.size() - 1);
			int ult = list.get(list.size() - 2);
			
			if (ult - fst <= tarRange) return total;
			
			if (snd - fst > ult - pen ) {
				list.remove(0);
				total += 1;
				return RecPoints(list, total, tarRange);
			} else if (snd - fst == ult - pen) {
				ArrayList<Integer> a = list;
				a.remove(0);
				ArrayList<Integer> b = list;
				b.remove(list.size());
				total += 1;
				return Math.min(RecPoints(a,total,tarRange), RecPoints(b,total,tarRange));
				
			} else {
				list.remove(list.size() - 1);
				total += 1;
				return RecPoints(list, total, tarRange);
			}
			
		}	
		
	}
	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]);
		}
		// Initiating variables -----------
		
		
		/*
		// Iteration attempt
		while (tarRange < accRange) {
			if (listLength == 1) {
				accRange = 0;
			} else {
				// && accRange - (list.get(1) - list.get(0)) < tarRange
				// If options are equally good it should be weighed on the next option down and so on
				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(RecPoints(list,0, tarRange));
		
	}
}
