#include<bits/stdc++.h>
using namespace std;
#define REP(i,a,b) for(i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)
#define mygc(c) (c)=getchar()
#define mypc(c) putchar(c)
#define ll long long
#define ull unsigned ll
void reader(int *x){int k,m=0;*x=0;for(;;){mygc(k);if(k=='-'){m=1;break;}if('0'<=k&&k<='9'){*x=k-'0';break;}}for(;;){mygc(k);if(k<'0'||k>'9')break;*x=(*x)*10+k-'0';}if(m)(*x)=-(*x);}
void reader(ll *x){int k,m=0;*x=0;for(;;){mygc(k);if(k=='-'){m=1;break;}if('0'<=k&&k<='9'){*x=k-'0';break;}}for(;;){mygc(k);if(k<'0'||k>'9')break;*x=(*x)*10+k-'0';}if(m)(*x)=-(*x);}
void reader(double *x){scanf("%lf",x);}
int reader(char c[]){int i,s=0;for(;;){mygc(i);if(i!=' '&&i!='\n'&&i!='\r'&&i!='\t'&&i!=EOF) break;}c[s++]=i;for(;;){mygc(i);if(i==' '||i=='\n'||i=='\r'||i=='\t'||i==EOF) break;c[s++]=i;}c[s]='\0';return s;}
template <class T, class S> void reader(T *x, S *y){reader(x);reader(y);}
template <class T, class S, class U> void reader(T *x, S *y, U *z){reader(x);reader(y);reader(z);}
template <class T, class S, class U, class V> void reader(T *x, S *y, U *z, V *w){reader(x);reader(y);reader(z);reader(w);}
void writer(int x, char c){int s=0,m=0;char f[10];if(x<0)m=1,x=-x;while(x)f[s++]=x%10,x/=10;if(!s)f[s++]=0;if(m)mypc('-');while(s--)mypc(f[s]+'0');mypc(c);}
void writer(ll x, char c){int s=0,m=0;char f[20];if(x<0)m=1,x=-x;while(x)f[s++]=x%10,x/=10;if(!s)f[s++]=0;if(m)mypc('-');while(s--)mypc(f[s]+'0');mypc(c);}
void writer(double x, char c){printf("%.15f",x);mypc(c);}
void writer(const char c[]){int i;for(i=0;c[i]!='\0';i++)mypc(c[i]);}
void writer(const char x[], char c){int i;for(i=0;x[i]!='\0';i++)mypc(x[i]);mypc(c);}
template<class T> void writerLn(T x){writer(x,'\n');}
template<class T, class S> void writerLn(T x, S y){writer(x,' ');writer(y,'\n');}
template<class T, class S, class U> void writerLn(T x, S y, U z){writer(x,' ');writer(y,' ');writer(z,'\n');}
template<class T> void writerArr(T x[], int n){int i;if(!n){mypc('\n');return;}rep(i,n-1)writer(x[i],' ');writer(x[n-1],'\n');}
char memarr[17000000]; void *mem = memarr;
#define MD 1000000007
int N, Q;
int A[3100000];
ll K;
int arr[3100000];
int main(){
int i, j, k;
ll tot; int cnt;
int res;
reader(&N,&Q);
rep(i,N) reader(A+i);
rep(i,N) A[i+N] = A[i];
rep(i,N) A[i+N+N] = A[i];
while(Q--){
reader(&K);
cnt = 0;
tot = 0;
rep(i,3*N){
if(tot + A[i] > K){ tot = 0; cnt++; }
tot += A[i];
arr[i] = cnt;
}
res = 3 * N;
REP(i,N,3*N) res = min(res, arr[i] - arr[i-N+1] + 1);
writerLn(res);
}
return 0;
}
I2luY2x1ZGU8Yml0cy9zdGRjKysuaD4KdXNpbmcgbmFtZXNwYWNlIHN0ZDsKCiNkZWZpbmUgUkVQKGksYSxiKSBmb3IoaT1hO2k8YjtpKyspCiNkZWZpbmUgcmVwKGksbikgUkVQKGksMCxuKQoKI2RlZmluZSBteWdjKGMpIChjKT1nZXRjaGFyKCkKI2RlZmluZSBteXBjKGMpIHB1dGNoYXIoYykKCiNkZWZpbmUgbGwgbG9uZyBsb25nCiNkZWZpbmUgdWxsIHVuc2lnbmVkIGxsCgp2b2lkIHJlYWRlcihpbnQgKngpe2ludCBrLG09MDsqeD0wO2Zvcig7Oyl7bXlnYyhrKTtpZihrPT0nLScpe209MTticmVhazt9aWYoJzAnPD1rJiZrPD0nOScpeyp4PWstJzAnO2JyZWFrO319Zm9yKDs7KXtteWdjKGspO2lmKGs8JzAnfHxrPic5JylicmVhazsqeD0oKngpKjEwK2stJzAnO31pZihtKSgqeCk9LSgqeCk7fQp2b2lkIHJlYWRlcihsbCAqeCl7aW50IGssbT0wOyp4PTA7Zm9yKDs7KX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