n , d = [int(x) for x in input().split()]
a = [int(x) for x in input().split()]
count = 0
for i in range(n):
    if(a[i]>min(a)):
        if (a[i] - min(a) > d):
            count+=1

if (count > 0):
    print (count)
else :
    print (0)