n,item=input().split()
n=int(n)
item=int(item)
list1=[int(x) for x in input().split()]
list1.sort()
counter=0
while(True):
    if(list1[-1]-list1[0]>item):
        list1.remove(list1[-1])
        counter+=1
    else:
        break
print(counter)