import java.util.*;
public class PL
{
public static void main(String args[])
{
Scanner sc=new Scanner(System.in);
int n=sc.nextInt();
int k=sc.nextInt();
long a[]=new long[n];
for(int i=0;i<n;i++)
a[i]=sc.nextLong();
Arrays.sort(a);
long m=0;
int e=a.length-1;
int f=0;
while(f==0)
{
if(a[e]-a[0]>k)
{
m++;
e=e-1;
}
else 
f=1;
}
System.out.println(m);
}
}