import sys readline = sys.stdin.readline from bisect import * from copy import * N, D = map(int, readline().split()) A = [] for i in range(N): A.append(int(readline())) B = deepcopy(A) B.sort() for i in range(N): print(bisect_right(B, A[i] - D))