#include <bits/stdc++.h>
using namespace std;
int n, Q, a[1000010], p[1000010], n1[1000010], cnt[1000010];
long long sum[1000010];
int work(long long m) {
  int j = 0;
  for (int i = 1; i <= n; i++) sum[i] = sum[i - 1] + a[i];
  if (sum[n] < m) return 1;
  for (int i = 1; i <= n; i++) {
    while (j + 1 <= n && sum[j + 1] - sum[i - 1] <= m) j++;
    p[i] = j;
  }
  for (int i = n; i; i--) {
    if (p[i] == n)
      cnt[i] = 1, n1[i] = i - 1;
    else
      cnt[i] = cnt[p[i] + 1] + 1, n1[i] = n1[p[i] + 1];
  }
  int ret = cnt[1], left = 1;
  long long Sum = sum[n];
  for (int i = 1; i < n; i++) {
    if (left <= i)
      left++;
    else
      Sum += a[i];
    while (left <= n && Sum > m) Sum -= a[left++];
    if (left <= n) ret = min(ret, cnt[i + 1] + (n1[i + 1] + 1 < left));
  }
  return ret;
}
int main() {
  scanf("%d%d", &n, &Q);
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
  long long m;
  while (Q--) {
    cin >> m;
    cout << work(m) << endl;
  }
  return 0;
}
