a = [int(i) for i in input().split()]
n = a[0]
d = a[1]
b = [int(i) for i in input().split()]
b.sort()
count = 0
j = 0
k = 0
for i in range(len(b)) :
    if abs(b[j] - b[n - (k+1)] ) > d :
        count += 1
        if i % 2 == 0 :
            k += 1
        else :
            j += 1
print(count)
    