"""
ACL0926_D
"""
import numpy as np

n,k=map(int,input().split())
a=[int(input()) for i in range(n)]
b=[0]*n
c=[0]*n

b[0]=a[0]
a[0]=0

for i in range(1,n):
    for j in range(0,n-1):
        c[j]=abs(a[j]-b[i-1])
        if c[j]>k:
            c[j]=0
    max_index=np.argmax(c)
    b[i]=a[max_index]
    a[max_index]=0

for i in range(n):
    if b[i]==0:
        for j in range (i,j):
            b[j]=0
            
ans=np.count_nonzero(b)
print(ans-1)