# 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(" ")]
min = min(points)
answer= sum((i - min) > diameter for i in points)
print(answer)