import bisect N,D=map(int,input().split()) pa=[int(input()) for _ in range(N)] pb=sorted(pa) for d in pa: n=bisect.bisect_left(pb,d+1-D) print(n)