import bisect _,D,*A = map(int,open(0).read().split()) B = sorted(A) for a in A: if a <= D: print(0) else: print(bisect.bisect_right(B, a-D))