#include<bits/stdc++.h>

#define st first
#define nd second
#define ll long long
#define ld long double

using namespace std;

typedef pair< int, int > ii;
typedef pair< int, ii > iii;

const int maxn = 2e5 + 3;
const int maxm = 1e6 + 3;
const int mod = 1e9 + 7;
const int oo = 1e9 + 5;

void input() {
    #define name "abc"
	if (fopen(name".inp" , "r") ){
        freopen(name".inp" , "r" , stdin);
        freopen(name".out" , "w" , stdout);
	}
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
}

int n , m ;
int a[maxn] , k[maxn] , root[maxn] , res[maxn] ;
ll prf[maxn] ;
set< pair< ld , int > , greater< pair< ld , int > > > s ;

int get_root (int i) {
    return root[i] == i ? i : root[i] = get_root(root[i]) ;
}

ld calc (int i , int j) {
    return 1.0 * (prf[j] - prf[i - 1]) / (j - i + 1) ;
}

int main() {
	input();
	cin >> n >> m ;
	for (int i = 1  ; i <= n ; ++ i) {
        cin >> a[i] ;
        prf[i] = prf[i - 1] + a[i] ;
        root[i] = i ;
	}
    for (int i = 1 ; i <= m ; ++ i) cin >> k[i] ;
    for (int i = 1 ; i < n ; ++ i) s.insert(make_pair((ld)a[i] , i)) ;
    int id = m , cur = 0 ;
//    cout << s.begin() -> st << "\n" ;
//    cerr << s.size() << "\n" ;
    while (!s.empty()) {
        while (id > 0 && k[id] >= s.begin() -> st) res[id --] = cur ;
//        cerr << id << " " << s.begin() -> nd << "\n" ;
        if (id < 1) break ;
        int p1 = s.begin() -> nd ;
        int p2 = get_root(p1) ;
        s.erase(make_pair(calc(p1 , p2) , p1)) ;
//        cerr << p1 << " " << p2 << "\n" ;
        root[p2] = p2 + 1 ;
        if (get_root(p2) < n) {
            s.erase(make_pair(calc(p2 + 1 , get_root(p2 + 1)) , p2 + 1)) ;
            s.insert(make_pair(calc(p1 , get_root(p1)) , p1)) ;
        }
        cur = max(cur , get_root(p1) - p1) ;
    }
    while (id > 0) res[id --] = n - 1 ;
    for (int i = 1 ; i <= m ; ++ i) cout << res[i] << " " ;

	return 0;
}
