#include <bits/stdc++.h>
using namespace std;
#define forsn(i,s,n) for(int i = int(s);i<int(n);i++)
#define dforsn(i,s,n) for(int i = int(n)-1;i>=int(s);i--)
#define forn(i,n) forsn(i,0,n)
#define dforn(i,n) dforsn(i,0,n)
#define DBG(x) do{cout<<#x<<" = "<<x<<endl;}while(false)
template<class T> ostream operator <<(ostream & out, vector<T> vec){
    out<<"[ ";
    for(auto k : vec) out<<k<<" , ";
    out<<"] ";
}
const int maxn = 3e5;
typedef long long intl;
int comp[maxn];
int l[maxn],r[maxn];
intl sum[maxn];
int findx(int nod){
    if(nod==comp[nod]) return nod;
    return comp[nod] = findx(comp[nod]);
}
int maxt = 1;
void Unir(int a, int b){
    a = findx(a);
    b = findx(b);
    if(a==b) return;
    sum[b] += sum[a];
    l[b] = min(l[a],l[b]);
    r[b] = max(r[a],r[b]);
    comp[a] = b;
}
int in[maxn],lim[maxn], res[maxn];
int main()
{
    cin.tie(0);
    cin.sync_with_stdio(0);
    int N,M; cin>>N>>M;
    priority_queue<pair<int,int> > PQ;
    forn(i,N){
        cin>>in[i];
        PQ.push({in[i]-1,i});
        sum[i] = in[i];
    }
    forn(i,N+10){
        comp[i] = l[i] = r[i] = i;
    }
    forn(i,M)cin>>lim[i];
    dforn(i,M){
       // DBG(i);
       //     DBG(PQ.top().first);
       ///     DBG(PQ.top().second);
        while(PQ.size() && PQ.top().first>=lim[i]){
            auto p = PQ.top().second;
            PQ.pop();
            if(p!=findx(p)) continue;
            if(r[p]<N-1){
                Unir(r[p],r[p]+1);
                p = findx(p);
                int tam = r[p]-l[p]+1;
                intl ok = sum[p]/tam;
                if(sum[p]%tam==0) ok--;
                if(ok>1e9) ok = int(1e9) + 1;
                if(r[p]<N-1)PQ.push({ok,p});
                maxt = max(maxt,tam);
             //   cout<<p<<" => "<<tam<<" : "<<r[p]<<" - "<<l[p]<<" + 1 "<<endl;
            }
        }
        res[i] = maxt-1;
    }
    forn(i,M) cout<<res[i]<<" ";
    return 0;
}
