#include <bits/stdc++.h>
int main(void) {
  int a[101];
  int b, c, d, i, j, count = 0, num, number;
  scanf("%d %d", &b, &c);
  for (i = 0; i < b; i++) {
    scanf("%d", &a[i]);
  }
  for (i = 0; i < b - 1; i++) {
    for (j = i + 1; j < b; j++) {
      if (a[i] > a[j]) {
        d = a[i];
        a[i] = a[j];
        a[j] = d;
      }
    }
  }
  for (i = 0; i < b; i++) {
    num = 0;
    number = 1;
    for (j = i + 1; j < b; j++) {
      num += a[j] - a[j - 1];
      if (num > c) {
        break;
      } else {
        number++;
      }
    }
    if (number > count) {
      count = number;
    }
  }
  printf("%d\n", b - count);
  return 0;
}
