#include <bits/stdc++.h>
namespace orz {
inline void read(int &x) { scanf("%d", &x); }
inline void read(unsigned int &x) { scanf("%u", &x); }
inline void read(long long &x) { scanf("%I64d", &x); }
inline void read(unsigned long long &x) { scanf("%I64u", &x); }
inline void read(double &x) { scanf("%lf", &x); }
inline void read(long double &x) {
  double tmp;
  read(tmp);
  x = tmp;
}
inline void read(char &x) { x = getchar(); }
inline void read(char *x) { scanf("%s", x); }
template <class T>
inline void read(T *a, int n) {
  for (int i = (0); i < (n); ++i) read(a[i]);
}
template <class T1, class T2>
inline void read(T1 &a, T2 &b) {
  read(a);
  read(b);
}
template <class T1, class T2, class T3>
inline void read(T1 &a, T2 &b, T3 &c) {
  read(a);
  read(b);
  read(c);
}
template <class T1, class T2, class T3, class T4>
inline void read(T1 &a, T2 &b, T3 &c, T4 &d) {
  read(a);
  read(b);
  read(c);
  read(d);
}
template <class T1, class T2, class T3, class T4, class T5>
inline void read(T1 &a, T2 &b, T3 &c, T4 &d, T5 &e) {
  read(a);
  read(b);
  read(c);
  read(d);
  read(e);
}
inline void write(int x) { printf("%d", x); }
inline void write(unsigned int x) { printf("%u", x); }
inline void write(long long x) { printf("%I64d", x); }
inline void write(unsigned long long x) { printf("%I64u", x); }
inline void write(double x) { printf("%.10lf", x); }
inline void write(long double x) { printf("%.10lf", (double)x); }
inline void write(char x) { putchar(x); }
inline void write(char *x) { printf("%s", x); }
template <class T>
inline void writes(T x) {
  write(x);
  putchar(' ');
}
template <class T1, class T2>
inline void writes(T1 a, T2 b) {
  writes(a);
  writes(b);
}
template <class T1, class T2, class T3>
inline void writes(T1 a, T2 b, T3 c) {
  writes(a);
  writes(b);
  writes(c);
}
template <class T1, class T2, class T3, class T4>
inline void writes(T1 a, T2 b, T3 c, T4 d) {
  writes(a);
  writes(b);
  writes(c);
  writes(d);
}
template <class T1, class T2, class T3, class T4, class T5>
inline void writes(T1 a, T2 b, T3 c, T4 d, T5 e) {
  writes(a);
  writes(b);
  writes(c);
  writes(d);
  writes(e);
}
template <class T1, class T2>
inline void writesln(T1 a, T2 b) {
  writes(a);
  writes(b);
  putchar('\n');
}
template <class T1, class T2, class T3>
inline void writesln(T1 a, T2 b, T3 c) {
  writes(a);
  writes(b);
  writes(c);
  putchar('\n');
}
template <class T1, class T2, class T3, class T4>
inline void writesln(T1 a, T2 b, T3 c, T4 d) {
  writes(a);
  writes(b);
  writes(c);
  writes(d);
  putchar('\n');
}
template <class T1, class T2, class T3, class T4, class T5>
inline void writesln(T1 a, T2 b, T3 c, T4 d, T5 e) {
  writes(a);
  writes(b);
  writes(c);
  writes(d);
  writes(e);
  putchar('\n');
}
template <class T1, class T2>
inline void writeln(T1 a, T2 b) {
  write(a);
  write(b);
  putchar('\n');
}
template <class T1, class T2, class T3>
inline void writeln(T1 a, T2 b, T3 c) {
  write(a);
  write(b);
  write(c);
  putchar('\n');
}
template <class T1, class T2, class T3, class T4>
inline void writeln(T1 a, T2 b, T3 c, T4 d) {
  write(a);
  write(b);
  write(c);
  write(d);
  putchar('\n');
}
template <class T1, class T2, class T3, class T4, class T5>
inline void writeln(T1 a, T2 b, T3 c, T4 d, T5 e) {
  write(a);
  write(b);
  write(c);
  write(d);
  write(e);
  putchar('\n');
}
template <class T1, class T2>
inline void write(T1 a, T2 b) {
  write(a);
  write(b);
}
template <class T1, class T2, class T3>
inline void write(T1 a, T2 b, T3 c) {
  write(a);
  write(b);
  write(c);
}
template <class T1, class T2, class T3, class T4>
inline void write(T1 a, T2 b, T3 c, T4 d) {
  write(a);
  write(b);
  write(c);
  write(d);
}
template <class T1, class T2, class T3, class T4, class T5>
inline void write(T1 a, T2 b, T3 c, T4 d, T5 e) {
  write(a);
  write(b);
  write(c);
  write(d);
  write(e);
}
template <class T>
inline void writeln(T x) {
  write(x);
  putchar('\n');
}
template <class T>
inline void writeln(T *a, int n) {
  for (int i = (0); i < (n); ++i) write(a[i]);
  putchar('\n');
}
template <class T>
inline void writesln(T *a, int n) {
  for (int i = (0); i < (n); ++i) writes(a[i]);
  putchar('\n');
}
template <class T>
inline void writelnln(T *a, int n) {
  for (int i = (0); i < (n); ++i) writeln(a[i]);
}
}  // namespace orz
using namespace orz;
int n, q;
long long a[2000007];
int til[2000007], ans[2000007];
inline void merge_until(int x, int t) {
  if (til[x] < t) {
    merge_until(til[x], t);
    ans[x] += ans[til[x]];
    til[x] = til[til[x]];
  }
}
int main() {
  scanf("%d%d", &n, &q);
  for (int i = (1); i <= (n); ++i) {
    scanf("%I64d", a + i);
    a[n + i] = a[i];
  }
  a[n * 2 + 1] = 10000000000000000LL;
  while (q--) {
    long long b;
    scanf("%I64d", &b);
    int j = 0;
    long long cs = 0;
    for (int i = (1); i <= (n * 2); ++i) {
      while (cs + a[j + 1] <= b) cs += a[++j];
      til[i] = j + 1;
      cs -= a[i];
      ans[i] = 1;
    }
    int tans = n * 10;
    for (int i = (1); i <= (n); ++i) {
      merge_until(i, i + n);
      if (ans[i] < tans) tans = ans[i];
    }
    printf("%d\n", tans);
  }
  return 0;
}
