#include using namespace std; using ll = long long; using ull = unsigned long long; using ld = long double; #define MOD 1000000007LL #define rep(i, n) for(ll (i) = 0LL;(i) < (ll)(n);(i)++) #define rep2(i, s, e) for(ll (i) = (ll)(s);(i) < (ll)(e);(i)++) #define repi(i, n) for(ll (i) = 0LL;(i) <= (ll)(n);(i)++) #define repi2(i, s, e) for(ll (i) = (ll)(s);(i) <= (ll)(e);(i)++) #define per(i, n) for(ll (i) = (ll)(n) - 1LL;(i) >= 0LL;(i)--) #define per2(i, s, e) for(ll (i) = (ll)(s) - 1LL;(i) >= (ll)(e);(i)--) #define peri(i, n) for(ll (i) = (ll)(n);(i) >= 0LL;(i)--) #define peri2(i, s, e) for(ll (i) = (ll)(s);(i) >= (ll)(e);(i)--) #define iter(i, it) for(auto &(i): (it)) template ostream& operator<<(ostream &s, const pair m) { cout << "(" << m.first << ", " << m.second << ")"; return s; } template ostream& operator<<(ostream &s, const map m) { ll c = 0; cout << "{ "; iter(i, m) cout << i << (c++ == m.size() - 1 ? " " : ", "); cout << "}"; return s; } template ostream& operator<<(ostream &s, const vector &v) { cout << "{ "; rep(i, v.size()) cout << v[i] << (i == v.size() - 1 ? " " : ", "); cout << "}"; return s; } template ostream& operator<<(ostream &s, const list &v) { ll c = 0; cout << "{ "; iter(i, v) cout << i << (c++ == v.size() - 1 ? " " : ", "); cout << "}"; return s; } int main(void) { ll N, D; cin >> N >> D; vector A(N), B; rep(i, N) cin >> A[i]; B = A; sort(B.begin(), B.end()); iter(i, A) { ll d = i - D; auto iter = upper_bound(B.begin(), B.end(), d); cout << distance(B.begin(), iter) << endl; } return 0; }