2 1
1 1
 4 1
2 2 1 1
 10 1
2 6 3 4 2 4 4 3 2 1
 2 1
999152 999153
 8 1000000
1 1 5 1000000 1000000 2 2 2
 9 2
1 6 1 5 5 8 6 8 7
 15 1
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
 1 4
8
 10 1
6 3 1 3 6 4 1 3 6 4
 10 1
1 2 3 5 6 8 10 11 9 4
 7 2
1 5 5 8 9 8 8
 2 1000000
1 1000000
 8 2
3 13 9 8 3 13 9 14
 1 1
1
 2 1
1 2

2
 2
 4
 1
 2
 4
 15
 1
 7
 2
 4
 1
 5
 1
 1

import java.util.*;
import java.util.Map.Entry;
import java.lang.*;
import java.math.*;
import java.text.*;
import java.io.*;
		public final class Solve {
		static PrintWriter out = new PrintWriter(System.out); 
		static void flush() {
	 	out.flush();
	 	}
		static void run(long s, long e) {
		NumberFormat formatter = new DecimalFormat("#0.00000");
		System.out.print("Execution time is " + formatter.format((e - s) / 1000d) + " seconds");
		}
		static class FastReader {
	    BufferedReader br;
	    StringTokenizer st;
	
	    public FastReader() {
	    br = new BufferedReader(new
	    InputStreamReader(System.in));
	    }
	    static boolean isPalindrome(String str1, String str2) {
	    String str3 = str1+str2;
	    int i = 0, j = str3.length()-1;
	    while(i < j) {
	    char a = str3.charAt(i), b = str3.charAt(j);
	    if(a != b) return false;
	    i++;j--;
	    }
	    return true;
	    }
	    static boolean isPalindrome(String str) {
	    int i = 0, j = str.length()-1;
	    while(i < j) {
	    char a = str.charAt(i), b = str.charAt(j);
	    if(a != b) return false;
	    i++;j--;
	    }
	    return true;
	    }
	    String next() {
	    while (st == null || !st.hasMoreElements()) {
	    try{st = new StringTokenizer(br.readLine());}
	    catch (IOException  e) {e.printStackTrace();}
	    }
	    return st.nextToken();
	    }
	    int nextInt(){ return Integer.parseInt(next()); }
	    long nextLong() { return Long.parseLong(next());}
	    static int fact(int n) {
	    if(n == 1) return 1;
	    return n * fact(n-1);
	   	}
	    public int[] readIntArray(int n) {
	    int[] arr = new int[n];
		for(int i=0; i<n; ++i)
		arr[i]=nextInt();
		return arr;
		}
	    public int[][] readIntArray(int m, int n){
		int[][] arr = new int[m][n];
		for(int i = 0;i<m;i++) 
		for(int j = 0;j<n;j++) 
		arr[i][j] = nextInt();
		return arr;
	    }
	    public String[] readStringArray(int n) {
		String[] arr = new String[n];
		for(int i=0; i<n; ++i)
		arr[i]= nextLine();
		return arr;
	    }
		static int gcd(int a, int b) { 
		if (b == 0) return a; 
		return gcd(b, a % b);  
		}
	    double nextDouble() {return Double.parseDouble(next());}
	    String nextLine() {
	    String str = "";
	    try{str = br.readLine();}
	    catch (IOException e) {e.printStackTrace();}
	    return str;}
	    }
		static void countSort(int[] arr, int n, int ex) {
			int[] out = new int[n];
			int[] cou = new int[10];
			
			for(int i = 0;i<n;i++) {
				cou[(arr[i]/ex)%10]++;
			}
			
			for(int i = 1;i<10;++i) {
				cou[i] += cou[i-1];
			}
			
			for(int i = n-1;i>=0;i--) {
				out[cou[(arr[i]/ex)%10]-1] = arr[i];
				cou[(arr[i]/ex)%10]--;
			}
			for(int i = 0;i<n;i++) {
				arr[i] = out[i];
			}
		}	
		static void radixSort(int[] arr, int n) {
			int m = arr[0];
			for(int i = 0;i<n;i++) {
				if(arr[i] > m) {
					m = arr[i];
				}
			}
			
			for(int ex = 1;m/ex > 0;ex *= 10) {
				countSort(arr, n, ex);
			}
		}
		static void solve(int[] arr, int n, int k) {
			if(n == 1) {
				out.println(1);
				return;
			}
			radixSort(arr, n);
			int i = 1;
			int j = 0;
			int l = 0;
			while(i < n) {
				if(arr[i] == arr[j]) {
					i++;
				}
				else if(arr[i] > arr[j] && arr[i] <= arr[j] + k) {
					if(j != i-1) {
						j++;
					}
					else {
						i++;
						j++;
					}
					l++;
				}
				else {
					if(j == i-1) {
						i++;
						j++;
					}
					else {
						j++;
					}
				}
			}
			out.println(n-l);
		}
		public static void main(String args[]) throws Exception {
	    FastReader sc = new FastReader();
	    long s = System.currentTimeMillis();
	    int n = sc.nextInt(), k = sc.nextInt();
	    int[] arr = sc.readIntArray(n);
	    solve(arr, n,k);
	    flush();
	    long e = System.currentTimeMillis();
//	    run(s,e);
	    }
	}
		
		
		