N,D = map(int,input().split()) A = {} l = [0]*N for i in range(N): a = int(input()) A.update({a:0}) l[i] = a ls = sorted(l) k = 0 for i in range(1,N): count = 0 for j in range(i): if ls[i] - ls[j] >= D: count += 1 A[ls[i]] = count for i in range(N): print(A[l[i]])