#include using namespace std; void solve() { int N; int64_t K; cin >> N >> K; vector A(N); for (auto &x : A) cin >> x; int64_t ans = 1LL << 61; for (int i = 0; i < N; i++) { int64_t curr = 1LL; for (int j = 0; j < N; j++) { if (j == i) { curr *= 1LL * (A[j] - K); } else { curr *= 1LL * A[j]; } } ans = min(ans, curr); } cout << ans << '\n'; } int main() { ios::sync_with_stdio(false); cin.tie(NULL); int t = 1; cin >> t; while (t--) solve(); return 0; }