from bisect import bisect_right N, D, *A = map(int, open(0).read().split()) t = sorted(A) for a in A: print(bisect_right(t, a - D))