#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k;
  cin >> n >> k;
  int ans = 0, m = 1;
  vector<int> a(n, 0);
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  for (int i = 0; i < n - 1; i++) {
    if (abs(a[i] - a[i + 1]) <= k)
      m++;
    else {
      ans = max(ans, m);
      m = 1;
    }
  }
  cout << ans << endl;
  return 0;
}
