#include #include #include #include using namespace std; int N,K,M; int A[2<<17]; int main() { ios::sync_with_stdio(false); cin.tie(nullptr); cin>>N>>K>>M; long sA=0; for(int i=1;i<=N;i++) { cin>>A[i]; sA+=A[i]; } if(sA%(N+1)!=0||sA==0) { cout<<-1< > >OK(T); vectorans(T+1); ans[T]=M; for(int i=1;i<=N;i++) { if(A[i]0) { int u=K-c+1; u=min(u,T-1); if(u<1) { cout<<-1<Q; for(int t=T-1;t>=1;t--) { for(auto[i,c]:OK[t])for(;c--;)Q.push(i); if(Q.empty()) { cout<<-1<