#int(input()) #map(int, input().split()) #list(map(int, input().split())) T = int(input()) ans = [] for i in range(T): D, A = map(int, input().split()) X = list(map(int, input().split())) a = [] c, d = divmod(A, 2) c += d for j in range(D): u, v = divmod(X[j], A) if v >= c: u += 1 a.append(u) ans.append(a) for i in range(T): print(" ".join([str(_) for _ in ans[i]]))