import sys
lines = sys.stdin.readlines()

n, d = map(lambda x: int(x), lines[0].split())
sequence = [int(x) for x in lines[1].split()]


def rank(arr):
    to_rank = []
    for idx, no in enumerate(arr):
        greate_d = 0
        for no_2 in arr:
            if abs(no - no_2) > d:
                greate_d = greate_d + 1
        to_rank.append((idx, greate_d))
    to_rank = sorted(to_rank, reverse=True, key=lambda x: x[1])
    return to_rank


invalid = True
counter = 0
while invalid:
    results = rank(sequence)
    if results[0][1] == 0:
        invalid = False
        break
    del sequence[results[0][0]]
    counter = counter + 1
print(counter)
