#include <bits/stdc++.h>
using namespace std;
inline long long read() {
  long long k;
  char ch;
  while ((ch = getchar()) < '0' || ch > '9')
    ;
  k = ch - '0';
  while ((ch = getchar()) >= '0' && ch <= '9') k *= 10, k += ch - '0';
  return k;
}
const int MAXN = 2000008;
long long sum[MAXN];
int dp[MAXN][2];
int n, m;
int main() {
  n = (int)read(), m = (int)read();
  for (int i = 1; i <= n; i++) sum[i] = read(), sum[i + n] = sum[i];
  for (int i = 1; i <= n * 2; i++) sum[i] += sum[i - 1];
  while (m--) {
    int x = (int)read();
    for (int i = 1; i <= n * 2; i++) dp[i][1] = i, dp[i][0] = 0;
    int pos = 1;
    int ans = 0x3fffffff;
    for (int i = n + 1; i <= n * 2; i++) {
      while (pos <= i && sum[i] - sum[pos - 1] > x) pos++;
      dp[i][0] = dp[pos - 1][0] + 1;
      dp[i][1] = dp[pos - 1][1];
      if (i - dp[i][1] >= n) ans = min(ans, dp[i][0]);
    }
    printf("%d\n", ans);
  }
  fclose(stdin);
  fclose(stdout);
  return 0;
}
