#include <bits/stdc++.h> 

#define INF INT_MAX/2
#define MOD 1000000007

using namespace std;

using ll = long long;
using ull = unsigned long long;

int main(){
   ios::sync_with_stdio(false);
   cin.tie(0);

   int N,Q;
   cin>>N>>Q;
   vector<ll>a(N),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++){
      ll res = 0;
      ll right = 0;
      ll sum = 0;
      for(int left=0;left<N;left++){
         while(sum+a[right] <= x[i] && right < N){
            sum += a[right];
            right++;
         }
         res += right - left;

         if(right == left) right++;
         else sum -= a[left];
      }
      cout<<res<<endl;
   }
   return 0; 
}

