n , d = [int(c) for c in input().split()]
a = [int(x) for x in input().split()]

a.sort()
f = a[0]
ans = 0

for i in range(n- 1, 0, -1):
    if a[i] - f > d:
        ans += 1
    else:
        break
print(ans)
