n , d = [int(c) for c in input().split()]
a = [int(x) for x in input().split()]

a.sort()
cp, cnt = d, 0
ans = []

for i in range(n - 1):
    d = cp
    cnt = 0
    for j in range(i, n - 1):
        if a[j + 1] - a[j] <= d and d >= 0:
            d -= (a[j] - a[i])
            if d >= 0:
                cnt += 1
        if d < 0:
            break
    ans.append(cnt)
if n == 1:
    print(0)
else:
    print(n - max(ans) - 1)
        
            
