#include <bits/stdc++.h>
using namespace std;
long long expo(long long x, long long y) {
  if (y == 1) return x;
  if (y % 2 == 1)
    return (x * (expo((x * x) % 1000000007, (y - 1) / 2)) % 1000000007) %
           1000000007;
  else
    return (expo((x * x) % 1000000007, y / 2)) % 1000000007;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  ;
  int t = 1;
  while (t--) {
    long long n, k;
    cin >> n >> k;
    long long a[n], i;
    for (i = 0; i < n; i++) cin >> a[i];
    long long dp[n + 1][2];
    dp[0][0] = 0, dp[0][1] = 0;
    for (i = 1; i <= n; i++) {
      if (abs(dp[i - 1][1] - a[i - 1]) <= k)
        dp[i][0] = dp[i - 1][0] + 1, dp[i][1] = a[i - 1];
      else
        dp[i][0] = dp[i - 1][0], dp[i][1] = dp[i - 1][1];
    }
    cout << dp[n][0] << endl;
  }
}
