#include using namespace std; vector costlyIntervals(int n, int k, vector arr) { vector ans(n,-1); long tempans = 0; for(long i=0;i= k){ tempans = j-i+1; } } for(long j = 0; j < tempans; j++){ if(tempans > ans[i+j]) ans[i+j] = tempans; } } return ans; } int main() { int n; int k; cin >> n >> k; vector A(n); for(int A_i = 0; A_i < n; A_i++){ cin >> A[A_i]; } vector result; if(k!=0) result = costlyIntervals(n, k, A); else { result.resize(n,n); } for (ssize_t i = 0; i < result.size(); i++) { cout << result[i] << (i != result.size() - 1 ? "\n" : ""); } cout << endl; return 0; }