1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#include<iostream>
#include<vector>
#include<set>
#include<map>
#include<algorithm>
using namespace std;

#define ll long long
#define pn push_back

#define FOR(i, a, b) for(int i =(a); i <=(b); ++i)
#define REP(i, n) for(int i = 0;i <(n); ++i)

int t[200000];
int d[200000];
int main(){
    ios_base::sync_with_stdio(0);
    int n,m;
    cin>>n>>m;
    REP(i,n)cin>>t[i];
    REP(i,m)cin>>d[i];
    long long C,T;

    REP(j,m){
        C = 0; T = 0;
        REP(i,n){
            if(T < t[i]-d[j])T=t[i]-d[j];
            T+=d[j];
            C+=T-t[i];
        }
        cout<<C<<"\n";
    }
    return 0;
}