#include <bits/stdc++.h>
using namespace std;
const int sz = 1e6 + 7;
int arr[sz], n, start_ind[sz], block[sz], last[sz];
long long csum[sz];
int solve(int b) {
  long long sum = 0;
  int mx = 0;
  int ans = n;
  for (mx = 0; mx < n; mx++) {
    start_ind[mx] = mx + 1;
    block[mx] = 0;
    if (csum[mx] > b) break;
  }
  if (mx == n) {
    ans = min(ans, 1);
    return ans;
  }
  int l = 0;
  for (int i = mx; i < n; i++) {
    while (csum[i] - csum[l] > b) l++;
    start_ind[i] = start_ind[l];
    block[i] = block[l] + 1;
  }
  sum = csum[n - 1];
  for (int i = 0; i < mx; i++) {
    sum += arr[i];
    while (sum - csum[l] > b) l++;
    start_ind[i] = start_ind[l];
    block[i] = block[l] + 1;
    if (start_ind[i] <= i + 1) {
      ans = min(ans, block[i]);
    }
  }
  return ans;
}
int main() {
  int q, a;
  scanf("%d %d", &n, &q);
  for (int i = 0; i < n; i++) {
    scanf("%d", &arr[i]);
    csum[i] = arr[i];
    if (i > 0) csum[i] += csum[i - 1];
  }
  while (q--) {
    scanf("%d", &a);
    printf("%d\n", solve(a));
  }
  return 0;
}
