#include"bits/stdc++.h" #include #define rep(i,n) for(ll i=0;i // T:重み using p_que = priority_queue,greater>; template bool chmin(T& a,T b){if(a>b){a=b;return true;}return false;} template bool chmax(T& a,T b){if(a0) {if(n&1)res=(res*(a%mod))%mod;a=((a%mod)*(a%mod))%mod;n>>=1;}return res;} template void RotateVec2(vector>&v){ll h=v.size();ll w=v[0].size();vector>t(w,vector(h));rep(i,h){rep(j,w){t[j][h-i-1]=v[i][j];}}v=t;} bool InRange(ll x, ll mn, ll mx){return (mn <= x && x <= mx);} template void printVec(vector&v,string str=" "){copy(ALL(v),experimental::make_ostream_joiner(cout, str));} template vector&merged(vector&a,vector&b) {vectorres;merge(a.begin(),a.end(),b.begin(),b.end(),back_inserter(res));return res;} struct UnionFind{ vectortree; UnionFind(ll x):tree(x, -1){} ll root(ll x){if(tree[x]<0) return x;return tree[x]=root(tree[x]);} bool same(ll x,ll y){return root(x)==root(y);} ll size(ll x){return -tree[root(x)];} void unite(ll x,ll y){x=root(x),y=root(y);if(x==y)return;if(size(x) struct SegTree{ ll e,n;vectortree;functionf; SegTree(ll n_,functionf_,T e_=0):e(e_),f(f_){ll x=1;while(x class modint { using u64 = std::uint_fast64_t; public: u64 a; constexpr modint(const u64 x = 0) noexcept : a(x % Modulus) {} constexpr u64 &value() noexcept { return a; } constexpr const u64 &value() const noexcept { return a; } constexpr modint operator+(const modint rhs) const noexcept {return modint(*this) += rhs;} constexpr modint operator-(const modint rhs) const noexcept {return modint(*this) -= rhs;} constexpr modint operator*(const modint rhs) const noexcept {return modint(*this) *= rhs;} constexpr modint operator/(const modint rhs) const noexcept {return modint(*this) /= rhs;} constexpr modint &operator+=(const modint rhs) noexcept {a += rhs.a;if (a >= Modulus) {a -= Modulus;}return *this;} constexpr modint &operator-=(const modint rhs) noexcept {if (a < rhs.a) {a += Modulus;}a -= rhs.a;return *this;} constexpr modint &operator*=(const modint rhs) noexcept {a = a * rhs.a % Modulus;return *this;} constexpr modint &operator/=(modint rhs) noexcept {u64 exp = Modulus - 2;while (exp) {if (exp % 2) {*this *= rhs;}rhs *= rhs;exp /= 2;}return *this;} constexpr modint &operator=(u64 x){ a = x % Modulus; return *this; } }; // MAIN PROGRAM ------------ int main(){ ll n, q; cin >> n >> q; vectorb; b.push_back(0); rep(i, n) { ll a; cin >> a; rep(j, a) { b.push_back(b.back() + j + 1); } } rep(idx, q) { ll s; cin >> s; auto itr = lower_bound(ALL(b), s); if(itr == b.end()) cout << -1 << endl; else cout << itr - b.begin() << endl; } }