#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) for(int x = 1; x <= A[i]; x++) B.push_back(x); 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); if(it == B_sum.end()) { cout << -1 << "\n"; } else { cout << it - B_sum.begin() << "\n"; } } }