mod = 998244353 eps = 10**-9 def main(): import sys from heapq import heappop, heappush input = sys.stdin.readline # comb init nmax = 10 ** 5 + 10 # change here fac = [0] * nmax finv = [0] * nmax inv = [0] * nmax fac[0] = 1 fac[1] = 1 finv[0] = 1 finv[1] = 1 inv[1] = 1 for i in range(2, nmax): fac[i] = fac[i - 1] * i % mod inv[i] = mod - inv[mod % i] * (mod // i) % mod finv[i] = finv[i - 1] * inv[i] % mod def comb(n, r): if n < r: return 0 else: return (fac[n] * ((finv[r] * finv[n - r]) % mod)) % mod for _ in range(int(input())): N, K = map(int, input().split()) A = list(map(int, input().split())) S = sum(A) B = [0] * N pq = [] for i in range(N): heappush(pq, (-A[i] * K, i)) for _ in range(K): v, i = heappop(pq) B[i] += 1 heappush(pq, (-A[i] * (1 / (B[i] + 1)), i)) S_inv = pow(S, mod-2, mod) T = K ans = 1 for i in range(N): ans = (ans * pow((A[i] * S_inv)%mod, B[i], mod))%mod ans = (ans * comb(T, B[i]))%mod T -= B[i] print(ans) assert T == 0 if __name__ == '__main__': main()