#include<bits/stdc++.h>
using namespace std;
#define int long long
#define pii pair<int,int>
#define fi first
#define se second
#define mp make_pair
const int N=200005;
int n,m,a[N],b[N],val[N];
set<int> S2;
multiset<int> S3;
set<pii >S1;
signed main(){
	scanf("%lld%lld",&n,&m);
	for (int i=1;i<=n;i++)scanf("%lld",&a[i]);
	a[n]=-1e18;
	for (int i=1;i<=n;i++)a[i]+=a[i-1];
	for (int i=1;i<=n;i++)S1.insert(mp(a[i-1]-a[i]+1,i)),S2.insert(i),S3.insert(1),val[i]=a[i]-a[i-1]-1;
	S2.insert(0);
	for (int i=1;i<=m;i++)scanf("%lld",&b[i]);
	for (int i=m;i;i--){
		while (S1.size()&&-(*S1.begin()).fi>=b[i]){
			pii now=*S1.begin();
			set<int>::iterator iter=S2.find(now.se),iter2=iter,iter3=iter;
			iter2--;iter3++;int x=*iter2,y=*iter3;
			S3.erase(y-(*iter));S3.erase((*iter)-x);
			S3.insert(y-x);
			S1.erase(S1.begin());
			S1.erase(mp(-val[y],y));
			val[y]=(a[y]-a[x]-1)/(y-x);
			S1.insert(mp(-val[y],y));
			S2.erase(now.se);
		}
		multiset<int>::iterator iter=S3.end();iter--;
		b[i]=*iter;
	}
	for (int i=1;i<=m;i++)printf("%lld ",b[i]-1);
}
