for _ in range(int(input())): d,a=map(int,input().split()) *x,=map(int,input().split()) for i in x: j=int(str(i*10//a)[-1]) print(i//a+(j>4))