#include #define rep(i,n) for(int i = 0; i < (n); i++) using namespace std; typedef long long ll; int main(){ cin.tie(0); ios::sync_with_stdio(0); int N,Q; cin >> N >> Q; vector A(N); rep(i,N) cin >> A[i]; vector B; rep(i,N) rep(j,i+1) B.push_back(A[j]); N = B.size(); vector B_sum(N + 1, 0); rep(i,N) B_sum[i + 1] += B_sum[i] + B[i]; rep(_,Q) { ll S; cin >> S; auto it = lower_bound(B_sum.begin(), B_sum.end(), S) - B_sum.begin(); cout << (it == N + 1 ? -1 : it) << "\n"; } }