#include <bits/stdc++.h>
int main(void) {
  int i, j, k, l, N, M, K, A[300000];
  scanf("%d %d", &N, &K);
  for (i = 0; i < N; i++) scanf("%d", &A[i]);
  for (l = M = 0; l < N; l++) {
    j = 0;
    k = -1;
    for (i = l; i < N; i++) {
      if (A[i] - j <= K) {
        k++;
        j = A[i];
      }
    }
    if (k > M) M = k;
  }
  printf("%d\n", M);
  return 0;
}
