#include <bits/stdc++.h>
const int maxlongint = 2147483647;
using namespace std;
const int N = 2000111;
int n, m;
int a[N], pre[N], cnt[N];
long long sum[N];
void init() {
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
  for (int i = 1; i <= n; i++) a[i + n] = a[i];
  for (int i = 1; i <= n * 2; i++) sum[i] = sum[i - 1] + a[i];
}
void solve() {
  for (int i = 1; i <= m; i++) {
    long long x;
    cin >> x;
    for (int i = 1; i <= n; i++) pre[i] = i, cnt[i] = 0;
    int p = 1;
    for (int j = n + 1; j <= n + n; j++) {
      while (sum[j] - sum[p] > x) p++;
      pre[j] = pre[p];
      cnt[j] = cnt[p] + 1;
      if (j - pre[j] >= n) {
        printf("%d\n", cnt[j]);
        break;
      }
    }
  }
}
int main() {
  init();
  solve();
  fclose(stdin);
  fclose(stdout);
  return 0;
}
