from itertools import combinations N, Q = map(int, input().split()) A = list(map(int, input().split())) B = list(map(int, input().split())) u = 1 for a in A: u *= a - 1 u %= 998244353 for b in B: if b < N / 2: result = 0 for c in combinations(A, N - b): t = 1 for i in c: t *= i - 1 t %= 998244353 result += t result %= 998244353 print(result) else: result = 0 for c in combinations(A, b): t = 1 for i in c: t *= i - 1 t %= 998244353 result += u * pow(t, 998244353 - 2, 998244353) result %= 998244353 print(result)