s = input().split()
n = int(s[0])
d = int(s[1])
s = input().split()
cl = []
mn = 100
for i in s:
    if int(i)<mn:
        mn = int(i)
    cl.append(int(i))
count = 0
for x in cl:
    if x-mn>d:
        count+=1

print(count)