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

public class A {

	public static void main(String[] args)
	{

			Scanner in = new Scanner(System.in);
			int cptD = 0, min = 0;
			int n = in.nextInt();

			int d = in.nextInt();

			int tab[] = new int[n];
			for(int i=0; i<n; i++)
				tab[i] = in.nextInt();

			min = tab[0];
			for(int i=0; i<n; i++)
			{
				if(min > tab[i]) {
					min = tab[i];
				}
			}

			for(int i=0; i<n; i++)
			{
				if(tab[i] != min) {
					if(Math.abs(tab[i] - min) > d)
						cptD++;
				}

			}

			System.out.println(cptD);
	}
    
}