using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Numerics;
using static System.Console;
using static System.Math;
using static System.Array;

class Program
{
    public static void Main()
    {
        var n = ReadLine().Split().Select(int.Parse).ToArray();
        var array = new int[n[0]];
        array[0] = int.Parse(ReadLine());
        var before = array[0];
        var count = 1;
        for(int i = 1; i < n[0]; i++)
        {
            array[i] = int.Parse(ReadLine());
            if(Abs(before - array[i]) <= n[1])
            {
                count++;
                before = array[i];
            }
        }
        if(count == 1)
            count = 0;
        Reverse(array);
        var countR = 1;
        before = array[0];
        for(int i = 1; i < n[0]; i++)
        {
            if(Abs(before - array[i]) <= n[1])
            {
                countR++;
                before = array[i];
            }
        }
        if(countR == 1)
            countR = 0;
        WriteLine(Max(count, countR));
    }
}
