#include<bits/stdc++.h>
using namespace std;

#define rep(i, a, n) for(int i=(a); i<(n); ++i)
#define per(i, a, n) for(int i=(a); i>(n); --i)
#define pb emplace_back
#define mp make_pair
#define clr(a, b) memset(a, b, sizeof(a))
#define all(x) (x).begin(),(x).end()
#define lowbit(x) (x & -x)
#define fi first
#define se second
#define lson o<<1
#define rson o<<1|1
#define gmid l[o]+r[o]>>1

using LL = long long;
using ULL = unsigned long long;
using pii = pair<int,int>;
using PLL = pair<LL, LL>;
using UI = unsigned int;

const int mod = 1e9 + 7;
const int inf = 0x3f3f3f3f;
const double EPS = 1e-8;
const double PI = acos(-1.0);

const int N = 2e5 + 10;

char nc() {
	static char buf[1000000], *p = buf, *q = buf;
	return p == q && (q = (p = buf) + fread(buf, 1, 1000000, stdin), p == q)
				? EOF
				: *p++;
}
int rd() {
	int res = 0;
	char c = nc();
	while (!isdigit(c)) c = nc();
	while (isdigit(c)) res = res * 10 + c - '0', c = nc();
	return res;
}

int n, m, mid, p, b[N], length[N];
LL sum[N];
bool vis[N];
vector<int> V[N];

bool ok(int id, LL v){
	return sum[id] > v * length[id];
}

void add(int x, int low, int top){
	if(low > top)	return;
	p = 0;
	while(low <= top){
		mid = low + top >> 1;
		if(ok(x, b[mid])){
			p = max(p, mid);
			low = mid + 1;
		} else {
			top = mid - 1;
		}
	}
	if(p){
		V[p].pb(x);
	}
}

int main(){
	int mx = 0, x, y;
	n = rd();
	m = rd();
	
	b[0] = 0;

	rep(i, 1, n+1){
		sum[i] = rd();
		length[i] = 1;
		vis[i] = 0;
	}

	rep(i, 1, m+1)	b[i] = rd();

	rep(i, 1, n)	add(i, 1, m);

	per(i, m, 0){
		for(int x : V[i]){
			if(vis[x])	continue;
			while(ok(x, b[i]) && x + length[x] <= n){
				y = x + length[x];
				vis[y] = 1;

				length[x] += length[y];
				sum[x] += sum[y];
				mx = max(mx, length[x] - 1);
			}
			if(x + length[x] <= n){
				add(x, 1, i - 1);
			}
		}
		b[i] = mx;
	}

	rep(i, 1, m+1)	printf("%d%c", b[i], i==m?'\n':' ');

	return 0;
}