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