#include using namespace std; #define ll long long #define rep(i, n) for (int i = 0; i < (n); i++) #define P pair int main() { int n, d; cin >> n >> d; vector a(n); vector id(n); rep(i,n) { cin >> a[i]; id[i] = a[i]; } sort(a.begin(), a.end()); rep(i,n) { int now = id[i]; int num = upper_bound(a.begin(), a.end(), now-d) - a.begin(); cout << num << endl; } }