n,d=map(int,input().split()) a=[int(input()) for _ in range(n)] b=a[:] b.sort() from bisect import bisect_left,bisect_right for aa in a: if aa-d>=0: print(bisect_right(b,aa-d)) else: print(0)