#include <bits/stdc++.h>
using namespace std;
#define int long long

signed main(){
  int N, Q; cin >> N >> Q;
  vector<int> a(N);
  for(int i = 0; i < N; i++) cin >> a[i];
  for(int i = 0; i < Q; i++){
    int x; cin >> x;
    int right = 0, sum = 0, ans = 0;
    for(int left = 0; left < N; left++){
      while(sum + a[right] <= x && right < N){
        sum += a[right];
        right++;
      }
      ans += right - left;
      if(left == right) right++;
      else sum -= a[left];
    }
    cout << ans << endl;
  }
}
