#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; typedef pair P; typedef long long ll; typedef long double ld; const int inf=1e9+7; const ll longinf=1LL<<60; #define REP(i,m,n) for(ll i=(int)(m) ; i < (int) (n) ; ++i ) #define rep(i,n) REP(i,0,n) #define F first #define S second constexpr char ln = '\n'; const int mx=200010; const ll mod=1e9+7; int main(){ ll n,d; cin >> n >> d; vector a(n); rep(i,n){ cin >> a[i]; } auto b = a; sort(b.begin(),b.end()); rep(i,n){ int ans = upper_bound(b.begin(),b.end(),a[i]-d) - b.begin(); cout << ans << ln; } return 0; }