#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

#define FIO                     ios::sync_with_stdio(false); cin.tie(nullptr)
#define TC(t)                   int t; cin >> t; for(int i = 1; i <= t; i++)
#define deb(x)                  cerr << #x << " = " << x << endl
#define deb2(x, y)              cerr << #x << " = " << x << ", " << #y << " = " << y << endl
#define f0(i, a, n)             for(i = a; i < n; i++)
#define f1(i, a, n)             for(i = a; i <= n; i++)
#define ini(x, y)               memset(x, y, sizeof(x))
#define all(x)                  x.begin(), x.end()
#define sz(x)                   x.size()
#define ll                      long long int
#define pb                      push_back
#define ppb                     pop_back
#define mp                      make_pair
#define ff                      first
#define ss                      second
#define M                       1000000007
#define endl                    '\n'
#define bits(x)                 __builtin_popcountll(x)
#define zrbits(x)               __builtin_ctzll(x)
#define vi                      vector<int>
#define pii                     pair<int,int>
#define vpii                    vector<pii>
#define ordered_set             tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>
#define multi_ordered_set       tree<int, null_type, less_equal<int>, rb_tree_tag, tree_order_statistics_node_update>

const int N = 1e5 + 1;
const int MX = 1e9;
const ll INF = 1e18;

using namespace std;
using namespace __gnu_pbds;

inline ll ceil(ll a,ll b) {return (a % b ? a / b + 1 : a / b);}
inline ll mod(ll x) {return ( (x % M + M) % M );}

template<typename T> ostream& operator<<(ostream& os, const vector<T>& v) {for(auto& x : v) os << x << " "; return os << '\n';}

void solve() {
        ll n, k, i;
        cin >> n >> k;
        
        ll a[n];
        for(i = 0; i < n; i++) {
                cin >> a[i];
        }

        vi ans;
        ans.pb(a[0]);
        f0(i, 1, n) {
                if(abs(ans.back()-a[i]) <= k) ans.pb(a[i]);
                else if(a[i] < ans.back()) {
                        ll in = find(all(ans), a[i]) - ans.begin();
                        ll l = 0, r = 0;
                        if(in-1 >= 0) l = abs(a[i] - a[i-1]);
                        if(in+1 < n) r = abs(a[i] - a[i+1]);
                        if(l <= k && r <= k) ans[in] = a[i];
                }
        }

        cout << ans.size() << endl;
}

int main () {
        FIO;
        // TC(t)
        solve();
        return 0;
}