#include const int Mod = 998244353; long long fact[100001], fact_inv[100001]; typedef struct { long double key; int id; } data; typedef struct { data obj[100001]; int size; } min_heap; void push(data x, min_heap* h) { int i = ++(h->size), j = i >> 1; data tmp; h->obj[i] = x; while (j > 0) { if (h->obj[i].key < h->obj[j].key) { tmp = h->obj[j]; h->obj[j] = h->obj[i]; h->obj[i] = tmp; i = j; j >>= 1; } else break; } } data pop(min_heap* h) { int i = 1, j = 2; data output = h->obj[1], tmp; h->obj[1] = h->obj[(h->size)--]; while (j <= h->size) { if (j < h->size && h->obj[j^1].key < h->obj[j].key) j ^= 1; if (h->obj[j].key < h->obj[i].key) { tmp = h->obj[j]; h->obj[j] = h->obj[i]; h->obj[i] = tmp; i = j; j = i << 1; } else break; } return output; } long long div_mod(long long x, long long y, long long z) { if (x % y == 0) return x / y; else return (div_mod((1 + x / y) * y - x, (z % y), y) * z + x) / y; } long long pow_mod(int n, int k) { long long N, ans = 1; for (N = n; k > 0; k >>= 1, N = N * N % Mod) if (k & 1) ans = ans * N % Mod; return ans; } long long combination(int n, int k) { return fact[n] * fact_inv[k] % Mod * fact_inv[n-k] % Mod; } void solve() { int i, j, k = 0, N, K, sum = 0; long long ans = 1; data d; static int A[100001], num[100001]; static long long prob[100001]; static long double likely[100001]; static min_heap h; h.size = 0; scanf("%d %d", &N, &K); for (i = 0; i < N; i++) { scanf("%d", &(A[i])); sum += A[i]; } for (i = 0; i < N; i++) { prob[i] = div_mod(A[i], sum, Mod); likely[i] = (long double)A[i] * K / sum; num[i] = (long long)A[i] * K / sum; k += num[i]; d.key = (num[i] + 1 - likely[i]) / likely[i]; d.id = i; push(d, &h); } for (i = 1; i <= K - k; i++) { d = pop(&h); j = d.id; num[j]++; d.key = (num[j] + 1 - likely[j]) / likely[j]; push(d, &h); } for (i = 0; i < N; i++) { ans = ans * pow_mod(prob[i], num[i]) % Mod * combination(K, num[i]) % Mod; K -= num[i]; } printf("%lld\n", ans); } int main() { int i; for (i = 1, fact[0] = 1; i <= 100000; i++) fact[i] = fact[i-1] * i % Mod; for (i = 99999, fact_inv[100000] = div_mod(1, fact[100000], Mod); i >= 0; i--) fact_inv[i] = fact_inv[i+1] * (i + 1) % Mod; int t, T; scanf("%d", &T); for (i = 1; i <= T; i++) solve(); fflush(stdout); return 0; }