#include using namespace std; int main() { int N, Q; cin >> N >> Q; vector V = {0}; for (int i = 0; i < N; i++) { int a; cin >> a; for (int j = 1; j <= a; j++) V.push_back(V.back() + j); } for (int i = 0; i < Q; i++) { int s; cin >> s; auto it = lower_bound(V.begin(), V.end(), s); if (it == V.end()) cout << -1 << endl; else cout << it - V.begin() << endl; } }