#include using namespace std; using ll = long long; #define rep(i,n) for (int i = 0; i < (n); ++i) #define rep2(i,m,n) for (int i = m; i < (n); ++i) #define all(x) (x).begin(),(x).end() inline int popcount(const int x) { return __builtin_popcount(x);} template void chmin(T &a, const T &b) noexcept { if (b < a) a = b;} template void chmax(T &a, const T &b) noexcept { if (a < b) a = b;} template void drop(const T &x) { std::cout< void debug_out(const T &x, const Args &... args) { std::cout<> n >> d; vector a(n); rep(i,n) cin >> a[i]; auto b = a; sort(all(b)); rep(i,n) { int ans = upper_bound(all(b), a[i] - d) - b.begin(); cout << ans << "\n"; } return 0; }