import sys inf = float("inf") # sys.setrecursionlimit(10**6) input = lambda: sys.stdin.readline().rstrip("\r\n") print = lambda *args, end="\n", sep=" ": sys.stdout.write( sep.join(map(str, args)) + end ) def II(): return int(input()) def MII(b=0): return map(lambda x: int(x) - b, input().split()) def LII(b=0): return list(MII(b)) for _ in range(II()): d, a = MII() xs = LII() res = [] for x in xs: # res.append(round(x / a)) t1, t2 = divmod(x, a) if t2 * 2 >= a: t1 += 1 res.append(t1) print(*res)