import java.util.Scanner;

public class Points_On_The_line {
	public static void main(String[]args) {
		Scanner sc = new Scanner(System.in);
		int n=sc.nextInt(), d=sc.nextInt();
		int arr [] = new int [n];
		boolean flags [] = new boolean[n];
		for(int i = 0 ; i < n ; i++)arr[i]=sc.nextInt();

		int count=0;
		for(int i = 0 ; i < n ; i++) {
			if(!flags[i]) 
				for(int j =  i+1 ; j < n ; j++) {
					if(!flags[j]) {
						if(Math.abs(arr[i]-arr[j])>d) {flags[j]=true;count++;}
					}
				}
		}
		System.out.println(count);
	}
}
