#include <bits/stdc++.h>
using namespace std;
int N, K;
int getAns(deque<int> dq, int idx, vector<deque<int>>& dqV) {
  if (idx == dqV.size()) return dq.size();
  deque<int> a, b;
  for (int i = 0; i < dqV[idx].size(); i++) {
    if (abs(dq.back() - dqV[idx][i]) <= K) {
      for (auto i : dq) a.push_back(i);
      for (int j = i; j < dqV[idx].size(); j++) a.push_back(dqV[idx][j]);
      break;
    }
  }
  for (int i = dq.size() - 1; i >= 0; i--) {
    if (abs(dq[i] - dqV[idx][0]) <= K) {
      for (int j = 0; j <= i; j++) b.push_back(dq[j]);
      for (auto i : dqV[idx]) b.push_back(i);
      break;
    }
  }
  int maxN = max(max(a.size(), dqV[idx].size()), max(b.size(), dq.size()));
  if (a.size() == maxN)
    return getAns(a, idx + 1, dqV);
  else if (b.size() == maxN)
    return getAns(b, idx + 1, dqV);
  else if (dqV[idx].size() == maxN)
    return getAns(dqV[idx], idx + 1, dqV);
  else
    return getAns(dq, idx + 1, dqV);
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cin >> N >> K;
  vector<int> v(N);
  for (int i = 0; i < N; i++) {
    cin >> v[i];
  }
  vector<deque<int>> dqV;
  deque<int> dq;
  dq.push_back(v[0]);
  for (int i = 1; i < N; i++) {
    if (abs(dq.back() - v[i]) > K) {
      dqV.push_back(dq);
      dq.clear();
    }
    dq.push_back(v[i]);
  }
  dqV.push_back(dq);
  cout << getAns(dqV.front(), 1, dqV);
}
