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:
        l.pop(-1)
        result += 1
        
    print(result)
    return
    
multi()