
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.io.StreamTokenizer;
import java.util.Arrays;


public class Main {
    static int [] res = new int [105];
    static int [] num = new int [105];
    static int n, d;
    static StreamTokenizer in = new StreamTokenizer(new BufferedReader(new InputStreamReader(System.in)));
    static PrintWriter out = new PrintWriter(new OutputStreamWriter(System.out));
    public static void main(String[] args) throws IOException {
        in.nextToken(); n = (int)in.nval;
        in.nextToken(); d = (int)in.nval;
        for(int i = 0; i < n; i++){
            in.nextToken();
            num[i] = (int) in.nval;
        }
        Arrays.sort(res, 0, n);
        for(int i = 1; i < n; i++){
            res[i] = num[i] - num[i - 1]; // 两个点相距的距离、、
        }
        // 接下来我 要判断能不能、、
        int a = solve(0, n - 1);
        out.println(a);
        out.flush();
    }
    
    private static int solve(int L, int R){
        int t = 0;
        if(num[R] - num[L] > d){ // 需要删点、、
            Math.min(t + 1, solve(L + 1, R) + 1);
            t = Math.min(solve(L, R - 1) + 1, solve(L + 1, R) + 1);
        }
        return t;
    }
    
}
