l = input().split()
n = int(l[0])
b = int(l[1])
l = input().split()
for i in range(len(l)):
    l[i] = int(l[i])
i = 0
while True:
    if max(l) - min(l) <= b:
        break
    else:
        del l[l.index(max(l))]
        i += 1
print(i)