n, d = map(int, input().split())
mas = list(map(int, input().split()))
mas.sort()
mas.reverse()
def dim(mas):
    return mas[0] - mas[len(mas)-1]
count = 0
while True:
    if len(mas) < 2:
        if len(mas) == 1:
            break
        else:
            count -= 1
            break
    gas = mas.copy()
    if dim(gas) == d:
        break
    else:
        del gas[0]
        if dim(gas) == d:
            count += 1
            break
        else:
            gas = mas.copy()
            del gas[len(gas) - 1]
            if dim(gas) == d:
                count += 1
                break
            else:
                count += 1
                if len(gas) > 0:
                    count += 1
                    del gas[0]
                    if len(gas) > 0:
                        if dim(gas) == d:
                            break
    mas = gas.copy()
print(count)