#include <algorithm>
#include <cstddef>
#include <cstdint>
#include <iomanip>
#include <iostream>
#include <map>
#include <string>
#include <vector>
#define rep(i, n) for (int i = 0; i < static_cast<int>(n); i++)

using namespace std;
using ll = int64_t;
int ary[100000];

ll cal(ll x, int n) {
  ll sum = 0, ans = 0;
  int right = 0;
  for (int i = 0; i < n; i++) {
    while (right < n && sum + ary[right] <= x) {
      sum += ary[right];
      right++;
    }
    ans += right - i;
    if (i == right)
      right++;
    else
      sum -= ary[i];
  }
  return ans;
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(10);

  int n, q;
  cin >> n >> q;
  for (int i = 0; i < n; i++)
    cin >> ary[i];
  while (q--) {
    ll x;
    cin >> x;
    cout << cal(x, n) << endl;
  }
}

