from itertools import combinations N, Q = map(int, input().split()) A = list(map(int, input().split())) B = list(map(int, input().split())) for b in B: 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)