/* -*- coding: utf-8 -*- * * 3472.cc: No.3472 繧ク繝」繝・ず繧ュ繝・繝シ縺ョ蠕・■譎る俣繧ッ繧ィ繝ェ - yukicoder */ #include #include using namespace std; /* constant */ const int MAX_N = 200000; /* typedef */ using ll = long long; /* global variables */ int ts[MAX_N]; ll tss[MAX_N + 1]; /* subroutines */ /* main */ int main() { int n, qn; scanf("%d%d", &n, &qn); for (int i = 0; i < n; i++) scanf("%d", ts + i); for (int i = 0; i < n; i++) tss[i + 1] = tss[i] + ts[i]; while (qn--) { ll x; scanf("%lld", &x); int i = upper_bound(tss, tss + n + 1, x) - tss - 1; printf("%d\n", i); } return 0; }