#include <bits/stdc++.h>
using namespace std;
int maxLen;
void fill(vector<int> v, int k, int i, int le, int len) {
  if (i == v.size()) {
    maxLen = max(maxLen, len);
    return;
  }
  fill(v, k, i + 1, le, len);
  if (le == INT_MIN || abs(le - v[i]) <= k) fill(v, k, i + 1, v[i], len + 1);
}
int main() {
  int n, k;
  cin >> n >> k;
  if (n == 0) {
    cout << 0;
    return 0;
  }
  vector<int> v(n);
  for (int i = 0; i < n; i++) cin >> v[i];
  maxLen = 1;
  fill(v, k, 0, INT_MIN, 0);
  cout << maxLen;
}
static int fastio = []() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(0);
  return 0;
}();
