#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int INF = 1 << 30;
const ll INFll = 1LL << 62;
const int mod = int(1e9) + 7;
using P = pair<int, int>;
using Pl = pair<ll, ll>;
using ld = long double;
using V = vector<int>;
using Vl = vector<ll>;
using VV = vector<vector<int>>;
using VVl = vector<vector<ll>>;
int main() {
  ll n, k;
  cin >> n >> k;
  Vl a(n);
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
  }
  vector<Pl> memo(n);
  ll mm = 0;
  for (int i = 0; i < n; ++i) {
    for (int j = mm; j >= 0; --j) {
      if (j == 0) {
        memo[j + 1].first = max(memo[j + 1].first, a[i]);
        memo[j + 1].second = min(memo[j + 1].second, a[i]);
        mm++;
      } else {
        if (abs(memo[j].first - a[i]) <= k) {
          memo[j + 1].first = max(memo[j + 1].first, a[i]);
          memo[j + 1].second = min(memo[j + 1].second, a[i]);
          mm++;
        }
        break;
      }
    }
  }
  cout << mm << endl;
}
