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.Scanner;

public class MicroWorld {
    static int k = 0;
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        k = scanner.nextInt();
        int[] bac = new int[n];
        for (int i = 0; i <n ; i++) {
            bac[i] = scanner.nextInt();
        }
        bac = mergeSort(bac);
        int c =0;
        for (int i = 0; i <n  ; i++) {
                if (i + 1 <= n -1)if (bac[i] != -1 && bac[i + 1] != -1) {
                if (bac[i] + k >= bac[i + 1] && bac[i] != bac[i + 1]) {
                    bac[i] = -1;
                    c++;
                }
            }
        }
        System.out.println(n -c);
    }
    public static int[] merge(int[] A1, int[] A2){
        int n =A1.length + A2.length;
        int[] C = new int[n];
        int i = 0, a1= 0, a2 = 0;
        while (a1 < A1.length && a2 < A2.length){
            if (A1[a1] > A2[a2]){
//                if (A1[a1] != -1 && A2[a2] != -1) {
//                    if (A2[a2] + k >= A1[a1]) {
//                        A2[a2] = -1;
//                    }
//                }
                C[i] = A2[a2];
                i++;a2++;
            }else {
//                if (A2[a2] != -1 && A1[a1] != -1) {
//                    if (A1[a1] + k >= A2[a2]) {
//                        A1[a1] = -1;
//                    }
//                }
                C[i] = A1[a1];
                i++;a1++;
            }
        }
        while (a1 < A1.length){
//            if (a1 + 1 < A1.length)if (A1[a1] != -1 && A1[a1 + 1] != -1) {
//                if (A1[a1] + k >= A1[a1 + 1]) {
//                    A1[a1] = -1;
//                }
//            }
            C[i] = A1[a1];
            a1++;i++;
        }
        while (a2 < A2.length){
//            if (a2 + 1 < A2.length)if (A2[a2] != -1 && A2[a2 + 1] != -1) {
//                if (A2[a2] + k >= A2[a2 + 1]) {
//                    A2[a2] = -1;
//                }
//            }
            C[i] = A2[a2];
            a2++;i++;
        }
        return C;
    }
    /*
    1. divides A into to arrays
    2. continues doing so until the lenght of one is 1
    3. calls merge
    ??
     */
    public static int[] mergeSort(int[] A){
        int n = A.length;
        if (n < 2){
            return A;
        }
        int r = (n - n%2)/2;
        int l = n - r;
        int R[] = new int[r];
        int L[] = new int[l];
        for (int i = 0; i < n; i++) {
            if (i < r){
                R[i] = A[i];
            }else {
                L[i - r] = A[i];
            }
        }
        R = mergeSort(R);
        L = mergeSort(L);
        return merge(R,L);
    }

}
