typedef long long ll; typedef long double ld; #include using namespace std; #define int long long signed main(){ ll n,q; std::cin >> n>>q; vector a(n); vector v; ll cur = 0; for (int i = 0; i < n; i++) { std::cin >> a[i]; for (int j = 1; j <= a[i]; j++) { cur += j; v.push_back(cur); } } for (int iii = 0; iii < q; iii++) { ll s; std::cin >> s; auto it = lower_bound(v.begin(),v.end(),s); if(it==v.end()){ std::cout << -1 << std::endl; }else{ std::cout << it-v.begin()+1 << std::endl; } } }