n, d = map(int, input().split())
p = list(map(int, input().split()))
ans = 0
m = min(p)
M = max(p)

while M - m > d:
    for i in p:
        if abs(i-m) > abs(i -M):
            ans += 1 
            p.remove(m)
            m = min(p)
        else:
            ans += 1
            p.remove(M)
            M = max(p)

print(ans)