#include <bits/stdc++.h>
using namespace std;
const int inf = int(1e9);
const double eps = 1e-9;
const double pi = 4 * atan(double(1));
const int N = int(1e6) + 100;
int a[N], _next[N], cnt[N];
long long s[N];
inline long long get_sum(int l, int r) { return s[r] - (l > 0 ? s[l - 1] : 0); }
int main() {
  int n, q;
  cin >> n >> q;
  for (int i = 0; i < n; ++i) {
    scanf("%d", a + i);
    s[i] = (i > 0 ? s[i - 1] : 0) + a[i];
  }
  for (int i = 0; i < q; ++i) {
    long long b;
    scanf("%lld", &b);
    int ptr = n;
    long long sum = 0;
    for (int j = n - 1; j >= 0; --j) {
      sum += a[j];
      while (sum > b) {
        sum -= a[--ptr];
      }
      if (ptr >= n) {
        _next[j] = j;
        cnt[j] = 0;
      } else {
        _next[j] = _next[ptr];
        cnt[j] = cnt[ptr] + 1;
      }
    }
    int ans = inf;
    sum = 0;
    for (int j = 0; j < n; ++j) {
      sum += a[j];
      if (sum > b) {
        break;
      }
      if (j == n - 1) {
        ans = min(ans, 1);
      } else {
        int pos = _next[j + 1];
        if (get_sum(pos, n - 1) + sum <= b) {
          ans = min(ans, cnt[j + 1] + 1);
        } else {
          ans = min(ans, cnt[j + 1] + 2);
        }
      }
    }
    printf("%d\n", ans);
  }
  return 0;
}
