#include <iostream>
#include <vector>
#include <algorithm>

std::vector<long long> minq(std::vector<long long> arr, std::vector<long long> queries) {
    long long n = arr.size();
    std::vector<long long> res;
    std::sort(arr.begin(), arr.end());
    std::vector<long long> ops(n, 0);
    long long s = 0;
    for (long long i = 0; i < n; i++) {
        s += arr[i];
        ops[i] = (i + 1) * arr[i] - s;
    }
    for (long long x : queries) {
        long long beg = 0, end = n - 1;
        while (beg <= end) {
            long long mid = (beg + end) / 2;
            if (ops[mid] <= x) {
                beg = mid + 1;
            } else {
                end = mid - 1;
            }
        }
        res.push_back(arr[beg - 1] + (x - ops[beg - 1]) / beg);
    }
    return res;
}

int main() {
    long long n;
    std::cin >> n;
    std::vector<long long> arr(n);
    for (long long i = 0; i < n; i++) {
        std::cin >> arr[i];
    }
    long long q;
    std::cin >> q;
    std::vector<long long> queries(q);
    for (long long i = 0; i < q; i++) {
        std::cin >> queries[i];
    }
    std::vector<long long> result = minq(arr, queries);
    for (long long x : result) {
        std::cout << x << "\n";
    }
    return 0;
}