#include using namespace std; #define REP(i,a,n) for(int i=(a); i<(int)(n); i++) #define rep(i,n) REP(i,0,n) #define FOR(it,c) for(__typeof((c).begin()) it=(c).begin(); it!=(c).end(); ++it) #define ALLOF(c) (c).begin(), (c).end() typedef long long ll; typedef unsigned long long ull; int solve(const vector& v, int x){ if(x <= 0) return 0; int lb = -1, ub = v.size(); while(ub-lb>1){ int m = (lb+ub)/2; if(v[m] <= x) lb = m; else ub = m; } return ub; } int main(){ int N, D; cin >> N >> D; vector v, w; rep(i,N){ int a; cin >> a; v.push_back(a); w.push_back(a); } sort(ALLOF(w)); rep(i,N){ int a = v[i]; cout << solve(w, a-D) << endl; } return 0; }