#include const int Mod = 998244353; long long fact[100001], fact_inv[100001]; typedef struct { long double key; int id; } data; void merge_sort(data x[], int n) { static data y[100001] = {}; if (n <= 1) return; merge_sort(&(x[0]), n/2); merge_sort(&(x[n/2]), (n+1)/2); int i, p, q; for (i = 0, p = 0, q = n/2; i < n; i++) { if (p >= n/2) y[i] = x[q++]; else if (q >= n) y[i] = x[p++]; else y[i] = (x[p].key < x[q].key)? x[p++]: x[q++]; } for (i = 0; i < n; i++) x[i] = y[i]; } 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, k = 0, N, K, sum = 0; long long ans = 1; static int A[100001], num[100001]; static long long prob[100001]; static data d[100001]; 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); num[i] = (long long)A[i] * K / sum; k += num[i]; d[i].key = (long double)A[i] * K / sum - num[i]; d[i].id = i; } merge_sort(d, N); for (i = 1; i <= K - k; i++) num[d[N-i].id]++; 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; }