# -*- coding: utf-8 -*-
n, d = map(int,raw_input().split())
x = map(int,raw_input().split())
x=list(set(x))
x.sort(reverse=True)
n=0
while(x[0]-x[-1]>d):
    n+=1
    if len(x)>2:
        if (x[0]-x[1])>(x[-2]-x[-1]):
            x.pop(0)
        else: x.pop(-1)
    else: x.pop(0)
print(n)
