Problem:
Score : 300 points

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.

Sample Input 1

6 1
3

Sample 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

Sample Input 2

10 2
4
5

Sample Output 2

0

There may be no way to climb up the stairs without setting foot on the broken steps.

Sample Input 3

100 5
1
23
45
67
89

Sample Output 3

608200469

Be sure to print the count modulo 1\ 000\ 000\ 007.

Solution in Rust (1.15.1) (judge verdict: Runtime Error)

const MODULO: u64 = 1_000_000_007;

fn read_line() -> String {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    s.trim_right().to_owned()
}

type ReadType = u64;
fn to_vec(s: String, offset: ReadType) -> Vec<ReadType> {
    s.split_whitespace()
        .map(|s| s.parse::<ReadType>().unwrap() - offset)
        .collect()
}

fn to_tuple(s: String) -> (ReadType, ReadType) {
    let v = to_vec(s, 0 as ReadType);
    (v[0], v[1])
}

fn mul(a: u64, b: u64) -> u64 {
    (a * b) % MODULO
}

fn div(a: u64, b: u64) -> u64 {
    // fermat's little theorem
    let mut p = MODULO - 2;
    let mut val = b;
    let mut inv: u64 = 1;
    while p > 0 {
        if p & 1 == 1 {
            inv = mul(inv, val);
        }
        val = mul(val, val);
        p /= 2;
    }

    mul(a, inv)
}

fn factorial(n: u64) -> u64 {
    (0..n).fold(1, |st, i| mul(st, n - i))
}

fn permutation(n: u64, r: u64) -> u64 {
    (0..(n - r)).fold(1, |st, i| mul(st, n - i))
}

fn count(n: u64) -> u64 {
    let mut sum = 0;
    let two_step_max = n / 2;
    for two_step in 1..(two_step_max + 1) {
        let one_step = n - mul(two_step, 2);
        let step = one_step + two_step;
        sum += div(permutation(step, one_step), factorial(two_step));
    }
    let one_step_only_case = 1;
    sum + one_step_only_case
}

fn evaluate(n: u64, v: &Vec<u64>) -> u64 {
    if v.windows(2).any(|w| w[0] + 1 == w[1]) {
        return 0;
    }

    let mut val = v.windows(2).fold(
        1,
        |st, w| mul(st, count(w[1] - w[0] - 2)),
    );
    val = mul(val, count(v[0] - 1));
    val = mul(val, count(n - *v.last().unwrap() - 1));
    val
}

fn main() {
    let (n, m) = to_tuple(read_line());
    let mut v: Vec<u64> = (0..m).map(|_| read_line().parse().unwrap()).collect();
    v.sort();

    println!("{}", evaluate(n, &v) % MODULO);
}