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