#include using namespace std; #ifdef LOCAL #include "settings/debug.cpp" #else #define Debug(...) void(0) #endif #define rep(i, n) for (int i = 0; i < (n); ++i) using ll = long long; using ull = unsigned long long; int main() { cin.tie(nullptr)->sync_with_stdio(false); int n, k; cin >> n >> k; vector a(n); rep(i, n) cin >> a[i]; vector res(n - k + 1); ll sum = 0; rep(i, k) sum += a[i]; rep(i, n - k + 1) { if (i > 0) sum += a[i + k - 1] - a[i - 1]; res[i] = sum; } sort(res.begin(), res.end()); int q; cin >> q; while (q--) { int x; cin >> x; cout << upper_bound(res.begin(), res.end(), x) - res.begin() << '\n'; } return 0; }