import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;
import java.util.Arrays;
import java.util.StringTokenizer;

public class PointsOnTheLine {
	static class FastReader {
		BufferedReader reader;
		StringTokenizer tokenizer;
		
		public FastReader() {
			reader = new BufferedReader(new InputStreamReader(System.in));
		}
		
		String next() {
			while(tokenizer == null || !tokenizer.hasMoreElements()) {
				try {
					tokenizer = new StringTokenizer(reader.readLine());
				} catch(IOException e) {
					e.printStackTrace();
				}
			}
			return tokenizer.nextToken();
		}
		
		int nextInt() {
			return Integer.parseInt(next());
		}
	}
	
	public static void main(String[] args) {
		FastReader fr = new FastReader();
		int n = fr.nextInt();
		int d = fr.nextInt();
		int[] input = new int[n];
		for(int i=0; i<n; i++) {
			input[i] = fr.nextInt();
		}
		Arrays.sort(input);
		int min = input[0];
		int count = 0;
		for(int i=n-1; i>=0; i--) {
			if(input[i] - min > d)
				count++;
			else
				break;
		}
		System.out.println(count);
	}
}
