#include <iostream>
#include <vector>
#include <cmath>
using namespace std;

int main()
{
  	int n, k;
  	cin >> n >> k;
	int a[n];
  	for (int i=0; i<n; i++)
  	{
    	cin >> a[i];
  	}
  	int len, maxlen=1;
  	for (int i=0; i<n; i++)
    {
        len = 0;
        for (int j=i+1; j<n; j++)
        {
            if (abs(a[j]-prev) <= k)
            {
                len++;
                prev = a[j];
            }
        }
        if (len > maxlen) maxlen = len;
    }

}
