#include <bits/stdc++.h>
int main() {
  int n, k, place = 1, dist = 0;
  scanf("%d %d", &n, &k);
  int a[n + 1], d[n], ans[n + 1];
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
    ans[i] = 0;
  }
  ans[1] = 1;
  for (int i = 2; i <= n; i++) {
    d[i] = a[i] - a[i - 1];
  }
  for (int i = 2; i <= n; i++) {
    if (-k <= d[i] && d[i] <= k) {
      if (-k > dist || dist > k) {
        place += 1;
      }
      ans[place] += 1;
      dist = 0;
    } else {
      dist += d[i];
    }
  }
  int ANS = 0;
  for (int i = 1; i <= n; i++) {
    if (ANS < ans[i]) {
      ANS = ans[i];
    }
  }
  printf("%d", ANS);
  return 0;
}
