#include <bits/stdc++.h>
int sort_inc(const void *a, const void *b) { return (*(int *)a - *(int *)b); }
int sort_dec(const void *a, const void *b) { return (*(int *)b - *(int *)a); }
int sort_dec_ll(const void *a, const void *b) {
  long long int da = *(long long int *)a, db = *(long long int *)b;
  int val = 0;
  if (da > db) {
    val = -1;
  } else if (da == db) {
    val = 0;
  } else {
    val = 1;
  }
  return val;
}
int sort_inc_ll(const void *a, const void *b) {
  long long int da = *(long long int *)a, db = *(long long int *)b;
  int val = 0;
  if (da > db) {
    val = 1;
  } else if (da == db) {
    val = 0;
  } else {
    val = -1;
  }
  return val;
}
int sort_dic(const void *a, const void *b) {
  char *pa = (char *)a;
  char *pb = (char *)b;
  int i = 0, val = 0, N = 10;
  for (i = 0; i < N; i++) {
    char da = pa[i], db = pb[i];
    if (da == db) continue;
    if (da > db)
      val = 1;
    else
      val = -1;
    break;
  }
  return val;
}
void yesno(int ans) {
  if (ans == 1) {
    printf("Yes\n");
  } else {
    printf("No\n");
  }
  return;
}
void okng(int ans) {
  if (ans == 1) {
    printf("OK\n");
  } else {
    printf("NG\n");
  }
  return;
}
int A[300002] = {0};
int main() {
  int N = 0, K = 0;
  scanf("%d %d", &N, &K);
  int i = 1;
  for (i = 1; i <= N; i++) {
    scanf("%d", &A[i]);
  }
  int ans1 = 1, ans2 = 1, ans = 0;
  int j = 1;
  i = 1;
  do {
    if (abs(A[i] - A[i + j]) <= K) {
      ans1++;
      i = (i + j);
      j = 1;
    } else {
      j++;
    }
  } while ((i + j) <= N);
  i = 2, j = 1;
  do {
    if (abs(A[i] - A[i + j]) <= K) {
      ans2++;
      i = (i + j);
      j = 1;
    } else {
      j++;
    }
  } while ((i + j) <= N);
  ans = (ans1 > ans2 ? ans1 : ans2);
  printf("%d\n", ans);
  return 0;
}
