def multi():
    inp = input().split(" ")
    k, d = int(inp[0]), int(inp[1])
    l = list(map(int, input().split(" ")))
    result = 0
    l.sort()
    
    while l[len(l) - 1] - l[0] > d:
        ind, toDelete = getIndex(l)
        for j in range(0, toDelete):
            l.pop(ind)
        result += 1
        
    print(result)
    return
    
def getIndex(l):
    first, last = l[0], l[-1]
    rr, ll = 1, 1
    for i in range(1, len(l)):
        if l[i] != first:
            return 0, i
        else:
            rr += 1
        if l[len(l) - 1 - i] != last:
            return -1, i
        else:
            ll += 1
    return 0, i + 1

multi()