import sys # sys.setrecursionlimit(200005) int1 = lambda x: int(x)-1 pDB = lambda *x: print(*x, end="\n", file=sys.stderr) p2D = lambda x: print(*x, sep="\n", end="\n\n", file=sys.stderr) def II(): return int(sys.stdin.readline()) def LI(): return list(map(int, sys.stdin.readline().split())) def LLI(rows_number): return [LI() for _ in range(rows_number)] def LI1(): return list(map(int1, sys.stdin.readline().split())) def LLI1(rows_number): return [LI1() for _ in range(rows_number)] def SI(): return sys.stdin.readline().rstrip() # dij = [(0, 1), (-1, 0), (0, -1), (1, 0)] # dij = [(0, 1), (-1, 0), (0, -1), (1, 0), (1, 1), (1, -1), (-1, 1), (-1, -1)] dij = [(-1, 1), (-1, 0), (-1, -1), (1, -1), (1, 1)] inf = (1 << 63)-1 # inf = (1 << 31)-1 # md = 10**9+7 md = 998244353 import numpy as np from numpy.fft import rfft, irfft def conv(aa, bb): m = len(aa)+len(bb) m = 1 << (m-1).bit_length() res = (irfft(rfft(aa, m)*rfft(bb, m))+0.5).astype("i8") r=np.searchsorted(res,lim,side="right") return res[:min(len(aa)+len(bb)-1,L+1,r)] lim=10**18 n, L = LI() cc = LI() aa = [] for c in cc: arr = np.ones(c+1, dtype="i8") aa.append(arr) for i in range(n-1)[::-1]: aa[i] = conv(aa[i], aa[i+1]) mx = aa[0][L] # print(aa) for i in range(n): cs = np.zeros(len(aa[i])+1, dtype="i8") cs[1:] = aa[i].cumsum() aa[i] = cs # print(aa) for _ in range(II()): k = II() if k > mx: print(-1) continue k -= 1 ans = [0]*n s = 0 for i in range(n-1): l = max(0, L-(s+cc[i])) r = np.searchsorted(aa[i+1], k+aa[i+1][l], side="right")-1 ans[i] = L-s-r s += ans[i] k -= aa[i+1][r]-aa[i+1][l] # print(l, r, s, k) ans[-1] = L-s print(*ans)