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