#include #include using namespace std; int main() { int n, q; cin >> n >> q; vector a(n); for (int i = 0; i < n; i++) cin >> a[i]; vector b; for (int i = 0; i < n; i++) { for (int j = 0; j <= i; j++) { b.push_back(a[j]); } } for (int i = 1; i < (int)b.size(); i++) { b[i] += b[i - 1]; } for (int i = 0; i < q; i++) { long long s; cin >> s; auto itr = lower_bound(b.begin(), b.end(), s); if (itr == b.end()) cout << -1 << endl; else { int idx = distance(b.begin(), itr); cout << idx + 1 << endl; } } return 0; }