#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k, a[1000001] = {}, s[1000001] = {}, r = 0, b;
  cin >> n >> k;
  for (int i = 0; i < n; i++) {
    cin >> b;
    a[b]++;
  }
  for (int i = 1; i < 1000001; i++) s[i] = s[i - 1] + a[i];
  for (int i = 1; i < 1000000; i++)
    if (s[min(i + k, 1000000)] - s[i] == 0) r += a[i];
  cout << r + a[1000000];
}
