#include <bits/stdc++.h>
using namespace std;
constexpr int kMod = 1000000007;
int main() {
  int N, K;
  cin >> N >> K;
  vector<set<int>> s;
  for (int i = 0; i < N; ++i) {
    int A;
    cin >> A;
    if (i == 0) {
      s.push_back({A});
      continue;
    }
    bool found = false;
    int k = s.size();
    for (int x : s[k - 1]) {
      if (abs(A - x) <= K) {
        found = true;
        break;
      }
    }
    if (found) {
      s.push_back({A});
      continue;
    }
    --k;
    for (; k > 0; --k) {
      for (int x : s[k - 1]) {
        if (abs(A - x) <= K) {
          found = true;
          break;
        }
      }
      break;
    }
    s[k].insert(A);
  }
  cout << s.size() << endl;
}
