#include #include #include using namespace std; int main(){ int N, K; cin >> N >> K; vector a(N); for (int i = 0; i < N; i++){ cin >> a[i]; } vector S(N + 1); S[0] = 0; for (int i = 0; i < N; i++){ S[i + 1] = S[i] + a[i]; } vector R; for (int i = 0; i <= N - K; i++){ R.push_back(S[i + K] - S[i]); } sort(R.begin(), R.end()); int Q; cin >> Q; for (int i = 0; i < Q; i++){ int x; cin >> x; cout << upper_bound(R.begin(), R.end(), x) - R.begin() << endl; } }