#include <iostream>
using namespace std;

int n, q;

int main(void){
    // Your code here!
    cin >> n >> q;
    
    long long a[n];
    long long x[q];
    
    for(int i = 0; i < n; i++) cin >> a[i];
    for(int i = 0; i < q; i++) cin >> x[i];
    
    
    
    for(int i = 0; i < q; i++){
        int left;
        int right = 0;
        long long ans = 0;
        long long sum = 0;
        for(int left = 0; left < n; left++){
            while(right < n && sum + a[right] <= x[i]){
                sum += a[right];
                right++;
            }
            
            ans += (right - left);
            if(right == left) right++;
            else sum -= a[left];
            
        }            
        
        cout << ans << endl;
    
    }
   
}

