#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;
int n, k;
vector<vector<int> > dp(300000, vector<int>(2, -1));
vector<int> a(300000);
int rec(int i, int flag) {
  if (dp[i][flag] != -1) return dp[i][flag];
  if (i == n - 1) return 0;
  if (flag == 0) {
    return dp[i][flag] = max(rec(i + 1, 1), rec(i + 1, 0));
  } else {
    if (abs(a[i + 1] - a[i]) <= k) {
      return dp[i][flag] = max(rec(i + 1, 1), rec(i + 1, 0)) + 1;
    } else {
      return dp[i][flag] = max(rec(i + 1, 1), rec(i + 1, 0));
    }
  }
}
int main() {
  cin >> n >> k;
  for (int i = 0; i < (n); ++i) {
    cin >> a[i];
  }
  int ans = max(rec(0, 0), rec(0, 1));
  cout << ans + 1 << endl;
  return 0;
}
