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