#include <bits/stdc++.h>
using namespace std;
pair<long long, long long> dp[300001];
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int n, k;
  cin >> n >> k;
  vector<long long> v(n + 1);
  stack<pair<int, int> > s;
  unordered_map<int, int> m;
  for (int i = 1; i <= (n); i++) {
    cin >> v[i];
    if (s.empty()) {
      m[i] = -1LL;
      s.push({v[i], i});
      continue;
    }
    if (v[i] - s.top().first <= k) {
      m[i] = s.top().second;
      s.push({v[i], i});
    } else {
      while (!s.empty() && v[i] - s.top().first > k) s.pop();
      if (s.empty()) {
        s.push({v[i], i});
        m[i] = -1LL;
      } else {
        m[i] = s.top().second;
        s.push({v[i], i});
      }
    }
  }
  dp[1] = {1, 1};
  for (int i = 2; i <= n; i++) {
    if (m[i] == -1) {
      if (dp[i - 1].first > 1LL) {
        dp[i] = {dp[i - 1].first, 0};
      } else {
        dp[i] = {1, 1};
      }
    } else {
      if (dp[m[i]].first + 1 > dp[i - 1].first) {
        dp[i] = {dp[m[i]].first + (dp[m[i]].second), 1};
      } else {
        dp[i] = {dp[i - 1].first, 0};
      }
    }
  }
  cout << dp[n].first << endl;
}
