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
#include <stdio.h>
#define RI _ri();
#define RL _rl();
#define RS(x) scanf(" %s",x)
#define WI(x) printf("%d\n",x)
#define WL(x) printf("%lld\n",x)
#define WS(x) puts(x)
#define RAI(x,n) FOR(_i,n) x[_i] = RI
#define RAL(x,n) FOR(_i,n) x[_i] = RL
#define FOR(x,y) for(int x = 0; x < y; x++)
static inline int _ri() { int r, i = scanf(" %d",&r); (void)i; return r; }
static inline long long _rl() { long long r, i = scanf(" %lld",&r); (void)i; return r; }
#define N 200200
long long t[N];
int main() {
  int n = RI;
  int m = RI;
  RAL(t,n);
  FOR(i,m) {
    long long r = 0;
    long long min = 0;
    int d = RI;
    FOR(j,n) {
      long long c = t[j];
      min += d;
      if (min < c) min = c;
      r += min - c;
    }
    WL(r);
  }
  return 0;
}