#include <bits/stdc++.h>

#define FASTIO
#define ff first
#define ss second
#define pb push_back
#define input(c, n) for (int i = 0; i < n; ++i) cin >> c[i];
#define exit_message(s) return 0 * printf(s)
#define show_all(c) for (auto i: c) cout << i << " "; cout << "\n";
#define display(c, a, n) cout << "Displaying array \"" << #c << "\" : \n"; for (int (i) = (a); (i) < (n); ++(i)) cout << (c)[(i)] << " "; cout << "\n";
#define forl(i, a, n) for (int i = (a); (i) < (n); ++(i))
#define dugbe(k) cerr << "-\t> " << #k << " = " << k << "\n";
#define dugbev(arr, idx) cerr << "-\t " << #arr << "[" << idx << "] : " << arr[idx] << "\n";
#define debug(args...) { string _debug_list = #args; replace(_debug_list.begin(), _debug_list.end(), ',', ' '); stringstream _debug_stream(_debug_list); istream_iterator<string> __it(_debug_stream); debug_func(__it, args); }

/*
// What follows is a magical ordered set data structure.
// Supports the following functions:
// find_by_order(int k) - returns k'th smallest element (0-indexed)
// order_of_key(int k) - returns number of elements strictly smaller than k.
using namespace __gnu_pbds;
#define ordered_set tree <ll, null_type, greater_equal <ll>, rb_tree_tag, tree_order_statistics_node_update>
*/

/* TIPS FOR DEBUGGING
 * Check if values are not overflowing (use long long where required)
 * Check if ranges are inclusive or not.
 * Check properly if greedy will work or not before using it.
 * Check EDGE CASES!! Seriously, even in 2B, saving 8 points by being
 * 2 minutes faster will bite you in the ass if you don't make sure
 * it works on edge cases.
 * Keep adding to this list.
*/

using namespace std;
typedef long long ll;
typedef pair<int, int> pr;
typedef pair<ll, ll> prll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<pr> vpr;
ifstream in("input.txt");
const ll mod = 1e9 + 7;
const long double eps = 1e-7;

void debug_func(istream_iterator<string> _it) {
	cerr << "\n";
}

template <typename T, typename... Args>
void debug_func(istream_iterator<string> _it, T x, Args... args) {
	cerr << "[ " << *_it << " : " << x << " ]";
	cerr << " , ";
	debug_func(++_it, args...);
}

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

long long true_rand(long long n) {
	// Returns a random number between 0 and n - 1 inclusive using mt19937.
	uniform_int_distribution<long long> uid(0, n - 1);
	return uid(rng);
}

ll mod_pow(ll a, ll b) {
	if (b == 0)
		return 1LL;

	ll res = mod_pow(a, b >> 1);
	res = (res * res) % mod;
	if (b & 1LL)
		res = (res * a) % mod;
	
	return res;
}

ll inverse(ll a) {
	return mod_pow(a, mod - 2);
}

const int N = 2e5 + 5;
const ll INF = 1e9 + 5, LLINF = 1e18 + 5;

int n, m;
vi a, k;
vi rep, nex, res;
vll sum;

int32_t main() {
	#ifdef FASTIO
		ios_base::sync_with_stdio(false);
		cin.tie(NULL);
	#endif
	// freopen("input.txt", "r", stdin);
	// freopen("output.txt", "w", stdout);

	cin >> n >> m;
	map<int, vi> mp;
	set<int> demands {0};
	a.resize(n);
	rep.resize(n);
	sum.resize(n);
	nex.resize(n);

	forl(i, 0, n) {
		cin >> a[i];
		mp[a[i]].pb(i);
		rep[i] = i;
		sum[i] = a[i];
		nex[i] = i + 1;
		demands.insert(a[i]);
	}
	k.resize(m);
	forl(i, 0, m) {
		cin >> k[i];
	}

	int last_demand = INF;
	int idx = m - 1;
	res.assign(m, 0);
	int ans = 0;

	while (true) {
		auto pos = demands.lower_bound(last_demand);
		if (pos == demands.begin())  {
			break;
		}
		--pos;
		int demand = *pos;
		for (; idx >= 0; --idx) {
			if (k[idx] < demand) {
				break;
			}
			res[idx] = ans;
		}

		// debug(demand, idx, ans);
		for (int day: mp[demand]) {
			int new_limit = -1;
			bool flag = false;
			do {
				int lef = rep[day];
				// debug(lef, day);
				if (lef != day) {
					flag = true;
					break;
				}
				if (nex[day] >= n) {
					flag = true;
					break;
				}
				int rig = rep[nex[day]];
				assert (rig == nex[day]);

				sum[lef] += sum[rig];
				rep[rig] = lef;
				int num_elem = (nex[rig] - lef);
				assert (num_elem != 0);
				ans = max(ans, num_elem - 1);
				new_limit = (sum[lef] + num_elem - 1) / num_elem;
				// debug(new_limit);
				nex[lef] = nex[rig];
			} while (new_limit == demand);
			if (new_limit == -1 || flag) {
				continue;
			}
			mp[new_limit].pb(day);
			demands.insert(new_limit);
		}
		last_demand = demand;
	}
	forl(i, 0, m) {
		cout << res[i] << " ";
	}
	cout << "\n";

	return 0;
}