#include <bits/stdc++.h>
using namespace std;
const int inf = 0x3f3f3f3f;
const long long INF = 0x3f3f3f3f3f3f3f;
const double pi = 3.1415926535897932384626;
inline long long read() {
  long long x = 0, f = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    x = (x << 1) + (x << 3) + (ch ^ 48);
    ch = getchar();
  }
  return x * f;
}
const int maxn = 3e5 + 5;
int n, k, a[maxn], ans = 1;
void dfs(int x, int val) {
  if (x == n) {
    ans = max(ans, val);
    return;
  }
  int i = n + 1;
  for (i = x + 1; i <= n; i++) {
    if (abs(a[x] - a[i]) <= k) break;
  }
  if (i <= n) dfs(i, val + 1);
  dfs(x + 1, 1);
}
int main() {
  n = read(), k = read();
  for (int i = 1; i <= n; i++) a[i] = read();
  dfs(1, 1);
  printf("%d\n", ans);
  return 0;
}
