#include <iostream>
#include <algorithm>
#include <atcoder/all>
#include <set>
using namespace std;
using namespace atcoder;

int main() {
	int N, K;
	cin >> N >> K;
	vector<int> A(N);
	for (int i = 0; i < N; i++) cin >> A[i];
	set<int> S;
	int ans = 1;
	S.insert(A[0]);
	for (int i = 1; i < N; i++) {
		set<int> NextS;
		for (int p : S) {
			if (abs(p - A[i]) <= K) {
				NextS = { A[i] };
				ans++;
				break;
			}
			else NextS.insert(p);
		}
		S = NextS;
	}
	cout << ans << endl;
}
