#include <bits/stdc++.h>
using namespace std;
long long max(vector<long long> a) { return *max_element(a.begin(), a.end()); }
long long max_index(vector<long long> a) {
  vector<long long>::iterator max_it = max_element(a.begin(), a.end());
  return distance(a.begin(), max_it);
}
long long n, k;
vector<long long> a(n);
long long ans = 0;
const int M = 2;
void dfs(vector<long long> &A) {
  if (A.size() == n) {
    long long count = std::count(A.begin(), A.end(), 1);
    if (count == 0) return;
    vector<long long> b;
    for (long long i = 0; i < (long long)(n); i++) {
      if (A[i] == 1) {
        b.push_back(a[i]);
      }
    }
    for (long long i = 0; i < (long long)(b.size() - 1); i++) {
      if (abs(b[i] - b[i + 1]) > k) {
        return;
      }
    }
    if (b.size() > ans) {
      ans = b.size();
    }
    return;
  }
  for (int v = 0; v < M; ++v) {
    A.push_back(v);
    dfs(A);
    A.pop_back();
  }
}
int main() {
  cin >> n >> k;
  a.resize(n);
  for (long long i = 0; i < (long long)(n); i++) {
    cin >> a[i];
  }
  vector<long long> A;
  dfs(A);
  cout << ans << endl;
  return 0;
}
