import math T=int(input()) for i in"_"*T: N,K=map(int,input().split()) *A,=map(int,input().split()) print(math.prod(A)//min(A)*(min(A)-K))