#include using namespace std; int main(){ int N, D; cin >> N >> D; vector> A(N); for(int i=0; i> A[i].first; A[i].second = i; } sort(A.begin(), A.end()); vector ans(N); int l = 0; for(int r=0; r= D) l++; ans[A[r].second] = l; } for(int a : ans) cout << a << endl; return 0; }