#include int main() { int n, q, len = 0; std::cin >> n >> q; std::vector a(n); for (int i = 0; i < n; i++) { std::cin >> a.at(i); len += a.at(i); } std::vector c(len + 1); int idx = 1; for (int i = 0; i < n; i++) { for (int j = 0; j < a.at(i); j++) { c.at(idx) = j + 1; idx++; } } for (int i = 0; i < len; i++) { c[i + 1] += c[i]; } for (int i = 0; i < q; i++) { int s; std::cin >> s; auto it = lower_bound(c.begin(), c.end(), s); if (it == c.end()) { std::cout << -1 << '\n'; } else { std::cout << it - c.begin() << '\n'; } } }