P11900 Unknown.

Background

Unknown, the terrifying Cat-demon, is the archenemy of “Furrmes”. One day, she saw an elementary-school math olympiad problem online: the Josephus problem.

Description

Unknown is going to commit another crime. She makes $n$ cats stand in a line. From left to right, their initial labels are $1,2,\dots,n$. At the same time, each cat initially stands on the cell with the same number as its label. Unknown has $k+1$ favorite numbers $t_0,t_1,\dots,t_k$. They satisfy: - $t_0=1$. - For $1\le i\le k$, $t_{i-1}

Input Format

The first line contains two integers $n$ and $k$, meaning there are $n$ cats in total, and Unknown has $k+1$ favorite numbers. The second line contains $k$ integers, representing $t_1$ through $t_k$, separated by spaces.

Output Format

Output one line with $n$ integers. The $i$-th integer is the probability that the cat with initial label $i$ is not petted, separated by spaces, taken modulo $998244353$.

Explanation/Hint

#### Sample Explanation: In the first sample, Unknown only likes the number $1$, so each time she will definitely pet the current first cat. Therefore, the first cat will surely be petted, and the second cat will surely not be petted. In the second sample, from left to right, the probabilities that the four cats are not petted are $0,\frac{1}{4},\frac{1}{4},\frac{1}{2}$. #### Constraints: **This problem uses bundled testdata.** For all testdata, it is guaranteed that $1\le n,k\le10^6$, and the range of $t_i$ is as described above. | # | Special Property | Score | | :--: | :--------------: | :---: | | 0 | $n\le 8$ | 10 | | 1 | $k=0$ | 5 | | 2 | $k=1$ | 10 | | 3 | $n\le5\times10^3$ | 15 | | 4 | $k\le 10$ | 15 | | 5 | $n\le2\times10^5$ | 20 | | 6 | No special restrictions | 25 | Postscript: Peanut: So what is Unknown’s real name? Furrmes: I don’t know, so she is called Unknown. Peanut: ? Translated by ChatGPT 5