#include #define rep(i,n) for(int i = 0; i < n; i++) #define srep(i,a,b) for(int i = a; i < b; i++) #define all(A) (A).begin(),A.end() #define MOD 1000000007 using namespace std; using ll = long long; using P = pair; using Graph = vector>; int siz(string s){return (int)s.size();} ll B[101010],S[101010]; int main(void){ int n,q; cin >> n >> q; int nn = 0; int p = 0; rep(i,n){ int a; cin >> a; nn += a; rep(j,a) B[p] = j+1,p++; } rep(i,nn+1) S[i+1] = S[i]+B[i]; rep(i,q){ ll s; cin >> s; int ans = 0; rep(j,nn+1){ if(S[ans] >= s) break; ans++; } cout << (ans == nn+1 ? -1 : ans) << endl; } return 0; }