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