import sys
d=int(raw_input().split(" ")[1])
x=raw_input().split(" ")
if len(x)==1:
    print 0
    sys.exit()
l=[]
for i in x:
    l.append(int(i))
ind=0
maxi=0
while ind!=len(l)-1:
    temp=l[ind]+d
    k=0
    for i in l[ind:]:
        if(i<=temp):
            k+=1
        else:
            break
    if(k>maxi):
        maxi=k
    ind=ind+1
print len(l)-maxi