#include <bits/stdc++.h>
using namespace std;
int n, k;
const int N = 2e5 + 10;
int a[N];
vector<int> sta;
int main() {
  ios ::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  cin >> n >> k;
  for (int i = 1; i <= n; ++i) {
    cin >> a[i];
  }
  sort(a + 1, a + 1 + n);
  for (int i = 1; i <= n; ++i) {
    while (sta.size() && sta.back() < a[i] && a[i] <= sta.back() + k) {
      sta.pop_back();
    }
    sta.push_back(a[i]);
  }
  cout << sta.size() << endl;
}
