from fractions import Fraction import heapq from itertools import count import sys input = sys.stdin.buffer.readline sys.setrecursionlimit(10 ** 7) mod = 998244353 U = 10 ** 5 + 10 fact = [1] * (U+1) inv = [1] * (U+1) for i in range(1, U+1): fact[i] = fact[i-1] * i % mod inv[U] = pow(fact[i], mod-2, mod) for i in reversed(range(U)): inv[i] = inv[i+1] * (i + 1) % mod T = int(input()) for _ in range(T): N, K = map(int, input().split()) A = list(map(int, input().split())) S = sum(A) % mod S_inv = pow(S, mod-2, mod) que = [(-Fraction(a), i) for i, a in enumerate(A)] heapq.heapify(que) cnt = [0] * N for _ in range(K): f, idx = heapq.heappop(que) f = -f num, div = f.as_integer_ratio() cnt[idx] += 1 heapq.heappush(que, (-Fraction(num, div + 1), idx)) res = fact[K] for i in range(N): res = res * pow(A[i] * S_inv, cnt[i], mod) res = res * inv[cnt[i]] % mod print(res)