#include #define ll long long using namespace std; vector costlyIntervals(ll n, ll k, vector A) { // Return a list of length n consisting of the answers vector v(n,-1); for(ll i=0;i=k) mind=max(mind, j); } // cout<-1) for(j=i;j<=mind;j++) v[j]=max(v[j], mind-i+1); } return v; } int main() { ll n; ll k; cin >> n >> k; vector A(n); for(ll A_i = 0; A_i < n; A_i++){ cin >> A[A_i]; } vector result = costlyIntervals(n, k, A); for (ssize_t i = 0; i < result.size(); i++) { cout << result[i] << (i != result.size() - 1 ? "\n" : ""); } cout << endl; return 0; }