#include <bits/stdc++.h>
using namespace std;
const int MOD = 1000000007;
const int INF = 1e9;
int n, k;
const int MAX = 3 * 1e5;
int a[MAX + 1];
int ans = 0;
vector<int> memo(MAX + 1, 0);
map<tuple<int, int, int>, int> m;
int dfs(int i, int last, int len) {
  if (i == n) {
    ans = max(ans, len);
    return 0;
  }
  if (m[make_tuple(i, last, len)] == 1) return 0;
  m[make_tuple(i, last, len)] = 1;
  dfs(i + 1, last, len);
  if (abs(a[i] - last) <= k) dfs(i + 1, a[i], len + 1);
  return 0;
}
int main() {
  cin >> n >> k;
  for (int i = 0; i < n; i++) cin >> a[i];
  int bet[MAX + 1];
  int betsum[MAX + 1];
  betsum[0] = 0;
  for (int i = 0; i < n - 1; i++) {
    bet[i] = a[i + 1] - a[i];
    betsum[i + 1] = betsum[i] + bet[i];
  }
  dfs(0, 0, 0);
  cout << ans << endl;
  return 0;
}
