from bisect import bisect_right _,D,*A = map(int,open(0).read().split()) B = sorted(A) print(*[bisect_right(B, a-D) for a in A], sep='\n')