#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using p = pair<int, int>;
const long long INF = 1ll << 60;
int main() {
  int N, K;
  cin >> N >> K;
  vector<int> A(N);
  for (int i = 0; i < (int)(N); i++) cin >> A[i];
  ll ans = 0;
  for (int bit = 0; bit < (int)((1 << N)); bit++) {
    vector<int> B;
    for (int i = 0; i < N; i++) {
      if (bit & (1 << i)) {
        B.push_back(A[i]);
      }
    }
    bool f = true;
    for (int i = 0; i < (int)(B.size() - 1); i++) {
      int sa = abs(B[i] - B[i + 1]);
      if (sa > K) f = false;
    }
    ll s = B.size();
    if (f == true) ans = max(ans, s);
  }
  cout << ans << endl;
  return 0;
}
