#include<bits/stdc++.h>

using namespace std;

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

#define int long long

vector<int> fw, tree;

void upd(int pos, int val) {
    for (; pos < (int)fw.size(); pos = (pos | (pos + 1))) {
        fw[pos] += val;
    }
}

int get(int r) {
    int ans = 0;
    for (; r >= 0; r = ((r & (r + 1)) - 1)) {
        ans += fw[r];
    }
    return ans;
}

int get(int v, int l, int r, int ql, int qr) {
    //push(v);
    if (l >= ql && r <= qr) {
        return tree[v];
    } else if (r <= ql || l >= qr) {
        return 0;
    } else {
        int m = (l + r) / 2;
        return get(2 * v + 1, l, m, ql, qr) + get(2 * v + 2, m, r, ql, qr);
    }
}

void update(int v, int l, int r, int ql, int qr, int val) {
    //push(v);
    if (l >= ql && r <= qr) {
        // tree[v] += val;
        //push(v);
    } else if (l >= qr || r <= ql) {
        return;
    } else {
        int m = (l + r) / 2;
        update(2 * v + 1, l, m, ql, qr, val);
        update(2 * v + 2, m, r, ql, qr, val);
        // push(v);
        tree[v] = tree[2 * v + 1] + tree[2 * v + 2];
    }
}

using T = double;

struct pv {
    T x, y;

    pv() : x(0), y(0) {}

    pv(T x, T y) : x(x), y(y) {}

    pv operator-(pv other) {
        return pv(x - other.x, y - other.y);
    }

    T operator%(pv other) {
        return x * other.y - y * other.x;
    }

    T get() {
        return x * x + y * y;
    }

    bool operator<(pv other) {
        return (x < other.x || (x == other.x && y < other.y));
    }
};

vector<pv> hull(vector<pv>& v) {
    int cur = 0, n = (int)v.size();
    pv mn = v[0];
    for (int i = 1; i < n; i++) {
        if (v[i] < mn) {
            cur = i;
            mn = v[i];
        }
    }
    vector<pv> ans;
    ans.push_back(v[cur]);
    swap(v[cur], v.back());
    v.pop_back();
    sort(v.begin(), v.end(), [&](pv a, pv b) {
        T f = (a - mn) % (b - mn);
        if (f != 0) {
            return f > 0;
        }
        return (a - mn).get() < (b - mn).get();
    });
    for (int i = 0; i < n - 1; i++) {
        int k = (int)ans.size();
        while (k >= 2) {
            if ((ans[k - 1] - ans[k - 2]) % (v[i] - ans[k - 1]) > 0) break;
            ans.pop_back();
            k--;
        }
        ans.push_back(v[i]);
    }
    return ans;
}

signed main() {
    // freopen("in.txt", "r", stdin);
    // freopen("out.txt", "w", stdout);
    cout.precision(20);
    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
    int n, m, t;
    cin >> n >> m >> t;
    vector<int> a(n);
    for (int i = 0; i < n; i++) {
        cin >> a[i];
    }
    vector<int> p_s(n + 1);
    for (int i = 0; i < n; i++) {
        p_s[i + 1] = p_s[i] + a[i];
    }
    for (int j = 0; j < m; j++) {
        int num;
        cin >> num;
        num--;
        int l = -1, r = num + 1;
        while (r - l > 1) {
            int mid = (l + r) / 2;
            if (p_s[num + 1] - p_s[mid] <= t) {
                r = mid;
            } else {
                l = mid;
            }
        }
        // cout << r << '\n';
        if (r == num + 1) {
            cout << 0 << '\n';
        } else {
            // if (t < (p_s[num + 1] - p_s[r])) assert(false);/e
            cout << (num - r + 1) + (t - (p_s[num + 1] - p_s[r])) / a[r] << '\n';
        }
        // if (p_s[num + 1] <= t) {
        //     cout << j + 1 + (t - p_s)
        // }
    }
}