#include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using namespace atcoder;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define PI 3.14159265358979323846
//#define int long long
constexpr long long INF = numeric_limits<long long>::max() / 2;
constexpr int MOD = 1000000007;
//constexpr int MOD = 998244353;
using Graph = vector<vector<int>>;

//-----------------------------------------------------------------------


signed main() {
    int n, d;
    cin >> n >> d;
    vector<int> x(n);
    mf_graph<int> g(n);
    for (int i = 0; i < n; i++) {
        cin >> x[i];
    }
    rep(i,n){
        for(int j=i+1;j<n;j++){
            if(abs(x[i]-x[j])<=d){
                g.add_edge(i,j,1);
            }
        }
    }
    cout<<n-g.flow(0,n-1)+1<<endl;




}
