/* package codechef; // don't place package name! */

import java.util.*;
import java.lang.*;
import java.io.*;

/* Name of the class has to be "Main" only if the class is public. */
public class Codechef
{
	public static void main (String[] args) throws java.lang.Exception
	{
		int n,d;
		
		Scanner sc = new Scanner(System.in);
		
	    n=sc.nextInt();
	    d=sc.nextInt();
	    
	    int points[]=new int [n];
	    int i,j;
	    for( i=0;i<n;i++)
	    {
	        points[i]=sc.nextInt();
	    }
		
		Arrays.sort(points);
		int flag[]= new int[n];
		
		for(i=n-1;i>0;i--)
		{
		    for(j=i-1;j>=0;j--)
		    {
		        if(points[i]-points[j]>d)
		        {
		            flag[i]=1;
		        }
		    }
		}
		
		int count=0;
		
		for(i=0;i<n;i++)
		{
		    if (flag[i]==1)
		    count++;
		    
		}
		System.out.print(count);
	}
}