#include #include using namespace std; using i32 = int; using i64 = long long; using i128 = __int128_t; using f64 = double; using p2 = pair; using el = tuple; using mint = atcoder::modint; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(18); _main(); } void _main() { i64 tt; cin >> tt; for (;tt--;) { i64 n, k; cin >> n >> k; i64 ans = 1e18; vector a(n); i64 s = 1; for (i64 i = 0; i < n; i++) { cin >> a[i]; s *= a[i]; } for (i64 i = 0; i < n; i++) { ans = min(ans, s / a[i] * (a[i] - k)); } cout << ans << "\n"; } }