N, D = map(int, input().split()) from bisect import bisect A = [int(input()) for i in range(N)] a = A.copy() A.sort() for i in a: print(bisect(A, i - D))