#include <iostream>
#include <vector>
using namespace std;
using ll = long long;

int main(){
  int n, q;
  cin >> n >> q;
  vector<ll> a(n);
  for(int i = 0; i < n; ++i){
    cin >> a[i];
  }

  for(int i = 0; i < q; i++){
    ll x;
    cin >> x;

    ll count = 0;
    int r = 0;
    ll tmp_sum = 0;
    for(int l = 0; l < n; ++l){
      while(r < n && tmp_sum + a[r] <= x){
        tmp_sum += a[r];
        ++r;
      }

      count += r - l;

      if(l == r)++r;
      else tmp_sum -= a[l];
    }

    cout << count << endl;
  }

}

