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