#include <bits/stdc++.h>
int main(void) {
  int N, K, A1, A2, i, count;
  scanf("%d %d", &N, &K);
  scanf("%d", &A1);
  for (i = 1; i < N; i++) {
    scanf("%d", &A2);
    if (abs(A1 - A2) <= K) count++;
    A1 = A2;
  }
  printf("%d\n", count);
  return 0;
}
