#include <bits/stdc++.h>
using namespace std;
int n;
int m;
int a[100005];
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= n; ++i) scanf("%d", &a[i]);
  sort(a + 1, a + 1 + n);
  int x = n;
  while (a[x] - a[1] >= m) {
    x--;
  }
  printf("%d", n - x);
}
