#include <bits/stdc++.h>
using namespace std;
int N, K;
vector<int> A;
vector<bool> result;
int Max;
void search(int index, int last) {
  if (index == N - 1) {
    int count = 0;
    for (int i = 0; i < N; i++) {
      if (result[i]) count++;
    }
    if (Max < count) Max = count;
    return;
  }
  if (last >= 0) {
    int diff = last - A[index + 1];
    if (diff < 0) {
      diff = 0 - diff;
    }
    if (diff > K) {
      result[index + 1] = false;
      search(index + 1, last);
    } else {
      result[index + 1] = true;
      search(index + 1, A[index + 1]);
      result[index + 1] = false;
      search(index + 1, last);
    }
  } else {
    result[index + 1] = true;
    search(index + 1, A[index + 1]);
    result[index + 1] = false;
    search(index + 1, last);
  }
}
int main() {
  cin >> N >> K;
  A.resize(N);
  result.resize(N);
  for (int i = 0; i < N; i++) {
    cin >> A[i];
  }
  Max = 0;
  result[0] = true;
  search(0, A[0]);
  result[0] = false;
  search(0, -1);
  cout << Max << endl;
  return 0;
}
