#include <bits/stdc++.h>
using namespace std;
long find(long a[], long n, vector<int> res, int curr, long k) {
  if (curr == n) {
    return res.size();
  }
  if (res.size() == 0 || abs(res[res.size() - 1] - a[curr]) <= k) {
    vector<int> temp = res;
    temp.push_back(a[curr]);
    long ans1 = find(a, n, temp, curr + 1, k);
    long ans2 = find(a, n, res, curr + 1, k);
    return max(ans1, ans2);
  }
  vector<int> temp;
  temp.push_back(a[curr]);
  long ans1 = find(a, n, temp, curr + 1, k);
  long ans2 = find(a, n, res, curr + 1, k);
  return max(ans1, ans2);
}
int main() {
  long n, k;
  cin >> n >> k;
  long a[n];
  for (int i = 0; i < n; i++) cin >> a[i];
  vector<int> res;
  long ans = find(a, n, res, 0, k);
  cout << ans;
}
