AtCoder Beginner Contest 129
C
Typical Stairs
AtCoder
⌀ 796
原题
← BD →
翻译中…

Problem Statement

翻译中…

There is a staircase with $N$ steps. Takahashi is now standing at the foot of the stairs, that is, on the $0$-th step. He can climb up one or two steps at a time.

翻译中…

However, the treads of the $a_1$-th, $a_2$-th, $a_3$-th, $\ldots$, $a_M$-th steps are broken, so it is dangerous to set foot on those steps.

翻译中…

How many are there to climb up to the top step, that is, the $N$-th step, without setting foot on the broken steps? Find the count modulo $1\ 000\ 000\ 007$.

翻译中…

Constraints

翻译中…
  • $1 \leq N \leq 10^5$
  • $0 \leq M \leq N-1$
  • $1 \leq a_1 < a_2 <$ $...$ $< a_M \leq N-1$
翻译中…

Input

翻译中…

Input is given from Standard Input in the following format:

翻译中…

N M
a_1
a_2
 .
 .
 .
a_M

翻译中…

Output

翻译中…

Print the number of ways to climb up the stairs under the condition, modulo $1\ 000\ 000\ 007$.

翻译中…

样例

Input #1
6 1
3
Output #1
4
There are four ways to climb up the stairs, as follows: - $0 \to 1 \to 2 \to 4 \to 5 \to 6$ - $0 \to 1 \to 2 \to 4 \to 6$ - $0 \to 2 \to 4 \to 5 \to 6$ - $0 \to 2 \to 4 \to 6$
Input #2
10 2
4
5
Output #2
0
There may be no way to climb up the stairs without setting foot on the broken steps.
Input #3
100 5
1
23
45
67
89
Output #3
608200469
Be sure to print the count modulo $1\ 000\ 000\ 007$.
题目信息
题号
abc129_c
时间限制
2 s
内存限制
1024 MB

题面与样例版权归 AtCoder 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。