import sys _,D,*A = map(int,open(0).read().split()) if len(A) < 2: print(0) sys.exit() A_sorted = sorted(A) for a in A: if a <= D: print(0) continue A_part = A_sorted[:A_sorted.index(a)][::-1] for i,p in enumerate(A_part): if a - p >= D: print(len(A_part[i:])) break