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

print(k)