import sys input = lambda : sys.stdin.readline().rstrip() sys.setrecursionlimit(2*10**5+10) write = lambda x: sys.stdout.write(x+"\n") debug = lambda x: sys.stderr.write(x+"\n") t = int(input()) items = [] N = 100 M = 998244353 sn = sk = 0 for _ in range(t): n,k = list(map(int, input().split())) a = list(map(int, input().split())) N = max(N, n+k+10) items.append((n,k,a)) sn += n sk += k assert all(1<=v<=1000 for v in a) assert 1<=n<=10**5 assert 1<=k<=10**5 assert 1<=t<=100 assert sn<=10**5 assert sk<=10**5 g1 = [0] * (N+1) # 元テーブル g2 = [0] * (N+1) #逆元テーブル inverse = [0] * (N+1) #逆元テーブル計算用テーブル g1[0] = g1[1] = g2[0] = g2[1] = 1 inverse[0], inverse[1] = [0, 1] for i in range( 2, N + 1 ): g1[i] = ( g1[i-1] * i ) % M inverse[i] = ( -inverse[M % i] * (M//i) ) % M # ai+b==0 mod M <=> i==-b*a^(-1) <=> i^(-1)==-b^(-1)*aより g2[i] = (g2[i-1] * inverse[i]) % M ans = [] for n,k,a in items: from heapq import heappop as hpp, heappush as hp, heapify h = [(-v,i) for i,v in enumerate(a)] heapify(h) x = [0]*n for _ in range(k): v,i = hpp(h) v *= -1 x[i] += 1 hp(h, (-a[i]/(x[i]+1), i)) val = g1[k] for i in range(n): val *= (pow(a[i], x[i], M) * g2[x[i]] % M) val %= M val *= pow(pow(sum(a), k, M), M-2, M) ans.append(val%M) write("\n".join(map(str, ans)))