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