#ABC303H. [ABC303Ex] Constrained Tree Degree

[ABC303Ex] Constrained Tree Degree

Score : 600600 points

Problem Statement

You are given an integer NN and a set S={S1,S2,,SK}S=\lbrace S_1,S_2,\ldots,S_K\rbrace consisting of integers between 11 and N1N-1.

Find the number, modulo 998244353998244353, of trees TT with NN vertices numbered 11 through NN such that:

  • diSd_i\in S for all i (1iN)i\ (1\leq i \leq N), where did_i is the degree of vertex ii in TT.

Constraints

  • 2N2×1052\leq N \leq 2\times 10^5
  • 1KN11\leq K \leq N-1
  • 1S1<S2<<SKN11\leq S_1 < S_2 < \ldots < S_K \leq N-1
  • All values in the input are integers.

Input

The input is given from Standard Input in the following format:

NN KK

S1S_1 \ldots SKS_K

Output

Print the number, modulo 998244353998244353, of the conforming trees TT.

4 2
1 3
4

A tree satisfies the condition if the degree of one vertex is 33 and the others' are 11. Thus, the answer is 44.

10 5
1 2 3 5 6
68521950
100 5
1 2 3 14 15
888770956

Print the count modulo 998244353998244353.