#include <bits/stdc++.h>
using namespace std;
long long a[1000001], n, m = INT_MAX, b[1000001], c, k1, c1, r, l, x,
                         m1 = INT_MAX, p1, p, k, t, tx1 = -1, ty1 = -1,
                         tx2 = -1, ty2 = -1, a1, b1, y, mid, mx = INT_MIN;
string s, s1, s2;
bool u[1000001];
map<long long, long long> mp;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> m;
  for (int i = 1; i <= n; i++) cin >> a[i];
  sort(a + 1, a + n + 1);
  for (int i = 1; i <= n; i++)
    for (int j = i + 1; j <= n; j++) {
      if (abs(a[i] - a[j]) > m && mp[a[i]] == 0 && mp[a[j]] == 0) {
        k++;
        l = i + 1;
        c = 0;
        p = 0;
        r = j - 1;
        while (a[l] - a[i] <= m && l <= n) {
          c++;
          l++;
        }
        l = i - 1;
        while (a[i] - a[l] <= m && l > 0) {
          c++;
          l--;
        }
        r = j + 1;
        while (a[r] - a[j] <= m && r <= n) {
          p++;
          r++;
        }
        if (c >= p)
          mp[a[j]]++;
        else
          mp[a[i]]++;
      }
    }
  cout << k;
}
