#include <bits/stdc++.h>
using namespace std;
long long a[200005];
long long sum[200005];
long long k[200005];
long long n, q;
long long last;
long long find(long long cur, long long x) {
  if (last != 0) {
    if (x < last) {
      last -= x;
      if (cur == n) cur = 0;
      return cur;
    }
    if (x == last) {
      last -= x;
      cur++;
      if (cur == n) cur = 0;
      return cur;
    }
    if (x > last) {
      x -= last;
      last = 0;
      cur++;
    }
  }
  long long ans = 0;
  long long l = cur, r = n;
  while (l <= r) {
    long long mid = (l + r) / 2;
    if (sum[mid] - sum[cur] <= x) {
      ans = max(ans, mid);
      l = mid + 1;
    } else {
      r = mid - 1;
    }
  }
  x -= (sum[ans] - sum[cur]);
  if (x != 0) last = a[ans + 1] - x;
  if (last < 0) last = 0;
  if (ans == n) ans = 0;
  return ans;
}
int main() {
  cin >> n >> q;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
    sum[i] = sum[i - 1] + a[i];
  }
  for (int i = 1; i <= q; i++) {
    cin >> k[i];
  }
  long long cur = 0;
  last = 0;
  for (int i = 1; i <= q; i++) {
    cur = find(cur, k[i]);
    cout << n - cur << endl;
  }
  return 0;
}
