#include <bits/stdc++.h>
// meow meow kace mi se grejduje
#pragma GCC optimize("O3")
#pragma GCC optimize("avx2")

using namespace std;
using ll = long long;
#define pb push_back

const int N = 2e5 + 5;
int stc[4*N], lzc[4*N], n;
__int128 lzs[4*N];
void push(int i) {
    if (lzs[i]) {
        lzs[2*i] += lzs[i];
        lzs[2*i+1] += lzs[i];
        lzs[i] = 0;
    }
    if (lzc[i]) {
        lzc[2*i] += lzc[i];
        lzc[2*i+1] += lzc[i];
        stc[2*i] += lzc[i];
        stc[2*i+1] += lzc[i];
        lzc[i] = 0;
    }
}
void upd(int l, int r, ll x, int i = 1, int l2 = 1, int r2 = n) {
    if (l <= l2 && r2 <= r) {
        lzs[i] += x;
        stc[i]--, lzc[i]--;
        return;
    }
    //cout << i << ' ' << l << ' ' << r << ' ' << l2 << ' ' << r2 << endl;
    push(i);
    int m2 = (l2+r2)/2;
    if (l <= m2)
        upd(l, r, x, 2*i, l2, m2);
    if (m2+1 <= r)
        upd(l, r, x, 2*i+1, m2+1, r2);
    stc[i] = min(stc[2*i], stc[2*i+1]);
}
array<ll, 2> f(int i = 1, int l2 = 1, int r2 = n) {
    if (l2 == r2) {
        array<ll, 2> t = {l2, lzs[i]};
        stc[i] = 1e9;
        return t;
    }
    push(i);
    int m2 = (l2+r2)/2;
    auto t = (stc[2*i] < stc[2*i+1] ? f(2*i, l2, m2) : f(2*i+1, m2+1, r2));
    stc[i] = min(stc[2*i], stc[2*i+1]);
    return t;
}
int main(){
    ios::sync_with_stdio(0);
    cin.tie(0);
    int x, k;
    cin >> n >> k >> x;
    ll s[n+2], a[n+2];  s[n+1] = 0;
    for (int i = 1; i <= n; ++i)    cin >> a[i];
    for (int i = n; i >= 1; --i)    s[i] = s[i+1]+a[i];
    int id[n+2];
    iota(id, id+n+2, 0);
    sort(id+1, id+n+2, [&](int x, int y) {
        return s[x] > s[y];
    });
    for (int i = 1; i <= n-k+1; ++i)    upd(i, i, s[i]-x*s[i+k]);
    ll ans[n+1];
    for (int i = 1; i <= n+1; ++i) {
        int p = id[i];
        //cout << "B" << endl;
        upd(max(p-k, 1), max(p-1, 1), s[p]);
        //cout << "A" << endl;
        while (stc[1] == -x) {
            auto t = f();
            //cout << i << ' ' << p << ' ' << s[p] << ' ' << t[0] << 'z' << t[1] << '\n';
            ans[t[0]] = t[1];
        }
    }
    for (int i = 1; i <= n-k+1; ++i) {
        cout << ans[i] << ' ';
    }
    cout << '\n';
}