#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++) {
    ll sum = 1;
    for (int i = 0; i < N - 1; i++) {
      if (bit & (1 << i)) {
        int sa = abs(A[i + 1] - A[i]);
        if (sa <= K) sum++;
      }
    }
    ans = max(ans, sum);
  }
  cout << ans << endl;
  return 0;
}
