n, d = map(int, input().split())
c = list(map(int, input().split()))
c = sorted(c)
k = 0
diam = c[-1] - c[0]
while diam > d:
    k += 1
    p = k
    q = 0
    while p >= 0:
        a = c[p:n - q]
        diam = min(diam, a[-1] - a[0])
        p -= 1
        q += 1

print(k)