/** * @FileName a.cpp * @Author kanpurin * @Created 2020.07.10 22:25:16 **/ #include "bits/stdc++.h" using namespace std; typedef long long ll; int main() { int n, d; cin >> n >> d; vector< pair > a(n); for (int i = 0; i < n; i++) { cin >> a[i].first; a[i].second = i; a[i].first *= -1; } vector< int > ans(n); sort(a.begin(), a.end()); for (int i = 0; i < n; i++) { ans[a[i].second] = (a.end() - lower_bound(a.begin(), a.end(), make_pair(a[i].first + d, -1))); } for (int i = 0; i < n; i++) { cout << ans[i] << endl; } return 0; }