from bisect import bisect n, d = map(int, input().split()) a = [int(input()) for i in range(n)] a2 = sorted(a) for i in a: print(bisect(a2, i - d))