#include <bits/stdc++.h>
using namespace std;
#define pb  push_back
#define ll  long long
#define vi  vector<ll >
#define vvi vector<vi >
#define all(x) x.begin(), x.end()

struct seg {
    ll l, r, s, k;
    seg() {};
    seg(ll l, ll r, ll s, ll k) : l(l), r(r), s(s), k(k) {};
};
bool operator<(seg a, seg b) { return a.l < b.l; }

ll n, m, len;
vi a, b, res;
set<seg> se;
set<pair<ll, ll> > ma;

int main() {
    ios_base::sync_with_stdio(false); cin.tie(0);
    cin >> n >> m;
    a.resize(n);
    for (auto& x : a) cin >> x;
    b.resize(m);
    for (auto& x : b) cin >> x;
    reverse(all(b));
    len = 0;
    for (int i = 0; i < n; ++i) {
        seg e(i, i, a[i], a[i] - 1);
        if (i == n - 1) e.k = 0;
        se.insert(e);
        ma.insert({e.k, e.l});
    }
    res.resize(m);
    for (int i = 0; i < m; ++i) {
        ll k = b[i];
        while ((--ma.end())->first >= k) {
            ll K = (--ma.end())->first;
            ll l = (--ma.end())->second;
            ma.erase({K, l});
            auto it = se.lower_bound(seg(l, 0, 0, 0));
            seg e = *it; se.erase(it);
            it = se.lower_bound(seg(l, 0, 0, 0));
            e.r  = it->r;
            e.s += it->s;
            e.k  = (e.s - 1) / (e.r - e.l + 1);
            if (e.r == n - 1) e.k = 0;
            ma.erase({it->k, it->l});
            se.erase(it);
            se.insert(e);
            len = max(len, e.r - e.l);
            ma.insert({e.k, e.l});
        }
        res[i] = len;
    }
    reverse(all(res));
    for (auto& x : res)
        cout << x << " ";
    cout << endl;

    return 0;
}