#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>

using namespace std;
using namespace __gnu_pbds;
using ll = long long;

template <class T> using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

signed main() {
    ios::sync_with_stdio(0);
    cin.tie(0);

    int n, m, t;
    cin >> n >> m >> t;

    vector <int> a(n), b(m), inds(n);
    vector <ll> pref(n+1);
    for (int i = 0; i < n; i++) {
        cin >> a[i];
        pref[i+1] = a[i] + pref[i];

        inds[i] = i;
    }

    sort(inds.begin(), inds.end(), [&a](int i, int j) {
        return a[i] < a[j];
    });

    for (int i = 0; i < m; i++) {
        cin >> b[i];
        b[i]--;
    }
    b.push_back(n);

    vector <ll> ans(n);

    for (int i : inds) {
        auto it1 = lower_bound(b.begin(), b.end(), i);
        auto it2 = it1;

        int lb1, lb2;

        if (it2 != b.begin()) {
            it2--;
            lb2 = *it2;
        } else {
            lb2 = -1;
        }

        lb1 = *it1;

        //cout << lb1 << ' ' << lb2 << ' ' << i << '\n';


        //if (lb)

        if (lb1 < n && pref[lb1 + 1] - pref[i+1] <= t)
            ans[lb1] = max(ans[lb1], (t - pref[lb1 + 1] + pref[i]) / a[i] + (lb1 - i));
        if (lb2 >= 0 && pref[i] - pref[lb2] <= t)
            ans[lb2] = max(ans[lb2], (t - pref[i] + pref[lb2]) / a[i] + (i - lb2));
    }

    for (int i = 0; i < n; i++) {
        cout << ans[i] << ' ';
    }

    cout << '\n';

    ll res = 0;
    for (int i = 0; i < m; i++) {
        res = max(res, ans[b[i]]);
    }

    cout << res << '\n';

}

/*

*/