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

#include <bits/stdc++.h>
using namespace std;
const int MX = 1 << 22;
const int MOD = 1000000007;
const int64_t mod2 = 1000000007 * 1LL * 1000000007;
double strtod(string second) {
  stringstream str(second);
  double number = 0;
  str >> number;
  return number;
}
int64_t strtoll(string second) {
  stringstream str(second);
  int64_t number = 0;
  str >> number;
  return number;
}
int64_t ff[50005], M[30005][505];
int64_t vis[100005], pref[100005];
int64_t cnt, n, m, second, t;
vector<int> gr[100005];
int dn[1005][1005];
char str[1001][1001];
int dx[] = {-1, 1, 0, 0, 1, -1, 1, -1};
int dy[] = {0, 0, -1, 1, 1, -1, -1, 1};
bool valid(int x, int y) {
  if (x >= 0 && x < n && y >= 0 & y < m) return true;
  return false;
}
int64_t dis[200005], dis2[200005];
vector<pair<int64_t, int64_t> > grp[200005];
void dijkstra(int64_t v) {
  set<pair<int64_t, int64_t> > second;
  second.insert({0, v});
  dis[v] = 0;
  while (!second.empty()) {
    auto ff = *second.begin();
    second.erase(second.begin());
    for (auto i : grp[ff.second]) {
      if (ff.second == n + 1) {
        if (dis[ff.second] + i.second < dis[i.first]) {
          second.erase({dis[i.first], i.first});
          dis[i.first] = dis[ff.second] + i.second;
          second.insert({dis[i.first], i.first});
        }
      } else {
        if (dis[ff.second] + 2 * 1LL * i.second < dis[i.first]) {
          second.erase({dis[i.first], i.first});
          dis[i.first] = dis[ff.second] + 2 * 1LL * i.second;
          second.insert({dis[i.first], i.first});
        }
      }
    }
  }
}
int Rank[100001], parent[100001], Color[100001][101];
int qu[200001], qq[200001], pai[200001], qar[200001];
int xxx[101], yyy[101];
int findSet(int x) {
  return (parent[x] = (parent[x] == x) ? x : findSet(parent[x]));
}
int isSameSet(int x, int y) { return findSet(x) == findSet(y); }
void unionSet(int x, int y) {
  if (!isSameSet(x, y)) {
    int xx = findSet(x), yy = findSet(y);
    if (Rank[xx] > Rank[yy]) {
      parent[yy] = xx;
    } else {
      parent[xx] = yy;
    }
    if (Rank[xx] == Rank[yy]) Rank[yy]++;
  }
}
bool isBetween(pair<int, int> a, pair<int, int> b, pair<int, int> c) {
  int crossproduct = (c.second - a.second) * (b.first - a.first) -
                     (c.first - a.first) * (b.second - a.second);
  if (abs(crossproduct) != 0) return false;
  int dotproduct = (c.first - a.first) * (b.first - a.first) +
                   (c.second - a.second) * (b.second - a.second);
  if (dotproduct < 0) return false;
  int squaredlengthba = (b.first - a.first) * (b.first - a.first) +
                        (b.second - a.second) * (b.second - a.second);
  if (dotproduct > squaredlengthba) return false;
  return true;
}
int64_t fast_pow(int64_t a, int64_t b, int64_t mod) {
  int64_t res = 1;
  while (b) {
    if (b & 1) {
      res = (1LL * res * a) % mod;
    }
    a = (1LL * a * a) % mod;
    b >>= 1;
  }
  return res;
}
int64_t MMI_fermat(int64_t n, int64_t MOD) { return fast_pow(n, MOD - 2, MOD); }
struct trie {
  int val;
  trie *child[2];
};
trie *get_node() {
  trie *new_node = new trie();
  new_node->val = 0;
  new_node->child[0] = NULL;
  new_node->child[1] = NULL;
  return new_node;
}
void add(trie *root, int key) {
  trie *head = root;
  for (int i = 29; i >= 0; i--) {
    bool bit = (key & (1 << i));
    if (head->child[bit] == NULL) {
      head->child[bit] = get_node();
    }
    head = head->child[bit];
  }
  head->val = key;
}
int get_Min(trie *root, int key) {
  trie *head = root;
  for (int i = 29; i >= 0; i--) {
    bool bit = (key & (1 << i));
    if (head->child[bit] != NULL) {
      head = head->child[bit];
    } else if (head->child[1 ^ bit] != NULL) {
      head = head->child[1 ^ bit];
    }
  }
  return key ^ (head->val);
}
int get_Max(trie *root, int key) {
  trie *head = root;
  for (int i = 29; i >= 0; i--) {
    bool bit = (key & (1 << i));
    if (head->child[1 ^ bit] != NULL) {
      head = head->child[1 ^ bit];
    } else if (head->child[bit] != NULL) {
      head = head->child[bit];
    }
  }
  return key ^ (head->val);
}
int st[MX];
pair<int, int> ar[MX];
int fans[MX];
void build_st(int l, int r, int idx) {
  if (l == r) {
    st[idx] = 1;
    return;
  }
  int mid = (l + r) / 2;
  build_st(l, mid, 2 * idx);
  build_st(mid + 1, r, 2 * idx + 1);
  st[idx] = st[2 * idx] + st[2 * idx + 1];
}
void print(int idx, int n) {
  if (2 * idx >= 2 * n) {
    cout << fans[idx] << " ";
    return;
  }
  print(idx * 2, n);
  print(2 * idx + 1, n);
}
void inversion_count(int second, int e, int ar[], int &ans) {
  if (second >= e) return;
  int mid = (second + e) / 2;
  inversion_count(second, mid, ar, ans);
  inversion_count(mid + 1, e, ar, ans);
  int i = second, j = mid + 1;
  int aux[e - second + 1];
  int k = 0;
  while (i <= mid && j <= e) {
    if (ar[i] <= ar[j]) {
      aux[k] = ar[i];
      k++;
      i++;
    } else {
      ans += (mid - i + 1);
      aux[k] = ar[j];
      k++;
      j++;
    }
  }
  while (i <= mid) {
    aux[k] = ar[i];
    k++;
    i++;
  }
  while (j <= e) {
    aux[k] = ar[j];
    k++;
    j++;
  }
  int l = second;
  for (int i = 0; i < k; i++) {
    ar[l] = aux[i];
    l++;
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int n, k;
  cin >> n >> k;
  int ar[n];
  for (int i = 0; i < n; i++) cin >> ar[i];
  sort(ar, ar + n);
  int ct = 0;
  for (int i = 0; i < n; i++) {
    int ub = upper_bound(ar, ar + n, ar[i] + k) - ar;
    if (ub - 1 != i && ar[ub - 1] - ar[i] <= k && ar[ub - 1] > ar[i]) {
      ar[i] = -1;
      ct++;
    }
  }
  cout << (n - ct) << "\n";
  return 0;
}
