#include using namespace std; typedef pair PII; int cost(int L, int R, const vector& A) { int minC = A[L]; int maxC = A[L]; int orC = A[L]; int andC = A[L]; for(int i=L+1; i<=R; ++i) { minC = min(minC, A[i]); maxC = max(maxC, A[i]); orC = orC | A[i]; andC = andC & A[i]; } return (orC - andC) - (maxC - minC); } vector costlyIntervals(int N, int K, const vector& A) { vector res(N, -1); for(int S=0; S= K) { for(int i=L; i<=R; ++i) { res[i] = S+1; } L = R; } } } return res; } int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); int N, K; cin >> N >> K; vector A(N); for(int i = 0; i < N; ++i){ cin >> 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; }