from bisect import bisect_right N, D = map(int,input().split()) A = [int(input()) for _ in range(N)] B = sorted(A) for a in A: print(bisect_right(B, a-D))