#include <bits/stdc++.h>
using namespace std;
int helper(vector<int>& v, int n, int k, int ind, int f) {
  if (ind < 0) return 0;
  if (f == 0) {
    return max(1 + helper(v, n, k, ind - 1, 1), helper(v, n, k, ind - 1, 0));
  }
  if (abs(v[ind] - v[ind + 1]) <= k) {
    return max(1 + helper(v, n, k, ind - 1, 1), helper(v, n, k, ind - 1, 1));
  }
  return helper(v, n, k, ind - 1, 1);
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n, k;
  cin >> n >> k;
  vector<int> v(n);
  for (int i = 0; i < n; i++) {
    cin >> v[i];
  }
  cout << helper(v, n, k, n - 1, 0);
  return 0;
}
