// This is the start of  template//
#include<bits/stdc++.h>
using namespace std;
#define endl "\n"
#define int long long int
#define vll vector<int>
#define pb push_back
#define pll pair<int,int>
#define mp(a,b) make_pair(a,b)
#define ff first
#define ss second
void input(){
#ifndef ONLINE_JUDGE 
freopen("input.txt","r",stdin);
freopen("output.txt","w",stdout); 
#endif
}
#define INF LONG_LONG_MAX
#define mod 1000000007
#define array(a,n) vll a(n); rep(i,0,n) cin>>a[i];
#define all(x) x.begin(),x.end()
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define cases int t; cin>>t; while(t--)
#define printall(a) rep(i,0,a.size()) cout<<a[i]<<" "; cout<<endl;
int power(int a,int n)
{
    if(n==0)
        return 1;
    if(n%2!=0)
    {
        return (a*power((a*a),n/2));
    }
    return power((a*a),n/2);
}
int lcm(int a,int b)
{
  return (a*b)/__gcd(a,b);
}

map<int,vector<int>>adj;
map<int,bool>vis;
void dfs(int u)
{
  vis[u]=1;
  for(auto ch:adj[u])
    if(!vis[ch])
      dfs(ch);
}
int32_t main()
{
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  input();
  int ans = 1;
  priority_queue<pair<int,int>>q;
  int n,k;
  cin>>n>>k;
  for(int i = 0;i<n ;i++)
  {
    int num,flag = 1;
    cin>>num;
    int s = q.size();
    priority_queue<pair<int,int>>temp;
    for(int i = 0;i<s;i++)
    {
        int cnt = q.top().first;
        int last = q.top().second;
        
        temp.push(q.top());
        q.pop();
        if(abs(num-last)<=k)
        {
          temp.push({cnt+1,num});
          flag = 0;
        }
    }
    if(flag)
      temp.push({1,num});
      q = temp; 
  } 
  //cout<<q.size();
  cout<<q.top().first<<endl;
}

//