# input() reads a string with a line of input, stripping the '\n' (newline) at the end.
# This is all you need for most Code Jam problems.
pairs= [int(s) for s in input().split(" ")]
num = pairs[0]
diameter = pairs[1]
points= [int(s) for s in input().split(" ")]
points.sort()
i =0
j = num -1
answer = 0
exit = False
while(not exit):
    if (points[j] - points[i]) > diameter:
        answer+=1
        dist1 = points[i]+ diameter
        dist2 = points[j] - diameter
        if ((j > 0) and dist1 > points[j -1]):
            i+=1
        else:
            j-=1
    else:
        exit = True

print(answer)