n=int(input()) def zen(d,a,lst): anslst=[] for i in range(d): x=(lst[i]*10)//a if 0<=x%10<5:pass else:x+=10 x//=10 anslst.append(x) return anslst for _ in range(n): d,a=map(int,input().split()) lst=list(map(int,input().split())) print(*zen(d,a,lst))