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