Hakurei Shrine 2 - MarisaOJ: Marisa Online Judge

Hakurei Shrine 2

Time limit: 1000 ms
Memory limit: 256 MB
Starting from step $0$, Marisa needs to climb up to step $n$ in order to reach the Hakurei Shrine atop the mountain. However, as time goes by, there are $m$ steps that have deteriorated, and if she steps on them, she will fall. If she takes $2$ or $3$ steps at a time, how many ways can she reach the shrine safely? ### Input - The first line consists of two integers $n$ and $m$. - The second line contains $m$ integers $M_i$, which represent the list of deteriorated steps. ### Output - Print a single integer, modulo $998244353$, since the answer can be very large. ### Constraints - $1 \le n \le 10^{18}$. - $1 \le m \le 10^4$. - $1 \le M_i \le n$. ### Example Input: ``` 8 3 1 2 4 ``` Output: ``` 2 ```