H. Harmony Coloring
time limit per test
1 second
memory limit per test
512 megabytes
input
standard input
output
standard output

A Suica Graph is defined as an undirected graph that can be constructed using the following procedures.

  1. Start with an empty graph (with no vertices or edges).
  2. Add a head vertex $$$H$$$.
  3. Add a tail vertex $$$T$$$.
  4. Add $$$N$$$ stripe chains $$$C_1, C_2, \dots, C_N$$$. Each chain is a set of degree-2 vertices. When adding chain $$$C_i$$$, we first add $$$l_i$$$ vertices, say $$$v_1, v_2, \dots, v_{l_i}$$$. Then add edges between adjacent vertices; i.e., for all $$$1 \leq j \lt l_i$$$, add edges between $$$v_j$$$ and $$$v_{j+1}$$$. Finally, add two edges $$$\{H, v_1\}$$$ and $$$\{v_{l_i}, T\}$$$.
  5. Add the stem chain. Suppose that the length of the stem chain is $$$S$$$, then add $$$S$$$ vertices denoted by $$$u_1, u_2, \dots, u_S$$$. Secondly, add edges between adjacent vertices; i.e., for all $$$1 \leq j \lt S$$$, add edges between $$$u_j$$$ and $$$u_{j+1}$$$. Finally, add edge $$$\{H, u_1\}$$$.

Here are some examples of Suica Graphs:

You are given a Suica Graph. For each vertex, you can color it red or blue. Please count how many different Harmony colorings there are. Since the answer could be large, you only need to output the remainder of the answer modulo by $$$998244353$$$.

A coloring is called Harmony if and only if:

  1. There is at least one red vertex and at least one blue vertex.
  2. For each pair of red vertices $$$(x, y)$$$, $$$x$$$ can reach $$$y$$$ through some edges without touching blue vertices.
  3. For each pair of blue vertices $$$(x, y)$$$, $$$x$$$ can reach $$$y$$$ through some edges without touching red vertices.

In other words, a coloring is Harmony if and only if the induced subgraph of red vertices is connected, the induced subgraph of blue vertices is connected, and both of them are not empty graphs (i.e., having at least one vertex).

Two coloring ways are considered different if and only if there exists a vertex colored differently in the two coloring ways.

Input

The first line of the input is the parameter $$$N, S$$$, seperated by space. $$$N, S$$$ are the number of stripe chains and the length of stem chain, respectively. The second line consists of $$$N$$$ integers $$$l_1, l_2, \dots, l_N$$$.

  • $$$1 \leq N \leq 10^5$$$
  • $$$1 \leq S \leq 10^5$$$
  • $$$1 \leq l_i \leq 10^5$$$, $$$\forall 1 \leq i \leq N$$$.
Output

Output a single integer between $$$0$$$ and $$$998244352$$$ represent the remainder of the number of different coloring ways.

Examples
Input
4 1
2 2 2 2
Output
188
Input
3 3
1 1 1
Output
28
Input
9 159
114 514 191 918 103 314 159 265 358
Output
37949969