ll n,d,a[2d5],b[2d5];{rd(n,d,a(n));b[0..n-1]=a[0..]+d;sortA(n,b);rep(i,n)wt(d=upper_bound(b,b+n,a[i])-b);}