import bisect n, d = map(int, input().split()) A = [int(input()) for _ in range(n)] for a in A: idx = bisect.bisect_right(A, a - d) print(idx)