
from collections import deque
import sys
input = sys.stdin.readline
n,k = map(int,input().split())

A = [int(input()) for i in range(n)]

ng = n+1
ok = 0

def queri(b):
    dp = list([0 for _ in range(b+1)] for _ in range(n+1)) 
    j = 0
    for i in range(n):
        la = dp[i][j]
        if abs(A[i]-la) <= k:
            dp[i+1][j+1] = A[i]
            j += 1
            if j == b:
                return True
                break
        else:
            dp[i+1][j] = la

    if dp[-1][-1] != 0:
        return True
    else:
        return False

while ng - ok > 1:
    mid = (ok+ng)//2
    if queri(mid) :
        ok = mid
    else:
        ng = mid
print(ok)