#include <stdio.h>
#include <iostream>
#include <queue>
#include <vector>
#pragma warning(disable:4996);
using namespace std;
int n, d;
vector<int> q;
const int maxn = 100010;
int f[maxn];
int main()
{
scanf("%d %d", &n, &d);
f[0] = 1;
for (int i = 0; i < n; i++)
{
int temp;
scanf("%d", &temp);
q.push_back(temp);
}
sort(q.begin(), q.end());
for (int i = 1; i < n; i++)
{
for (int j = 0; j < i; j++)
{
if (abs(q[i] - q[j]) >= d)
{
f[i] = max(f[j] + 1, f[i]);
}
}
}
cout << f[n - 1];
}
04-18
5853
08-16
1998
04-19
1849
11-06
301