import sys
try:sys.stdin,sys.stdout=open('in.txt','r'),open('out.txt','w')
except:pass
ii1=lambda:int(sys.stdin.readline().strip()) # for interger
is1=lambda:sys.stdin.readline().strip() # for str
iia=lambda:list(map(int,sys.stdin.readline().strip().split())) # for List[int]
isa=lambda:sys.stdin.readline().strip().split() # for List[str]
mod=int(1e9 + 7);from collections import *;from math import *

###################### Start Here ######################

n , k = iia()
arr = []
for _ in range(n):arr.append(ii1())
dp=[0]*n
dp[0]=1
# print(arr)
for i in range(n-1):
    if abs(arr[i+1]-arr[i])<=k:
        dp[i+1]=max(dp[i-1],dp[i])+1
    else:
        dp[i+1]=max(dp[i])
# print(dp)
print(dp[-1])
