use std::io::*;
use std::str::FromStr;
use std::vec::Vec;
use std::i32;

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char) 
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

fn calc_fib(max: i32) -> Vec<i64> {
    let mut ret = Vec::with_capacity(max as usize);
    ret.push(1 as i64);
    ret.push(1 as i64);
    let max2 = max as usize;
    let mod_num = 10i64.pow(9) + 7;
    let mut i: usize = 2;
    while i < max2 {
        let v1 = ret[i - 1];
        let v2 = ret[i - 2];
        ret.push((v1 + v2) % mod_num);
        i += 1;
    }
    return ret
}

fn solve(n: i32, a: Vec<i32>) -> i64 {
    let fib = calc_fib(10000);
    let count = a.len();
    let mod_num = 10i32.pow(9) + 7;
    let mut last: i32 = 0;
    let mut index: usize = 0;
    let mut total = 1 as i64;

    while index < count {
        let aa = a[index];
        index += 1;

        let steps = aa - last - 1;
        if index > 1 && steps <= 0 {
            return 0
        }
        last = aa + 1;
        total = total * fib[steps as usize] % (mod_num as i64);
    }
    let last_steps = n - last;
    if last_steps > 0 {
        total = total * fib[last_steps as usize] % (mod_num as i64);
    }
    return total
}

fn main() {
    let n: i32 = read();
    let m: i32 = read();
    let a = (0..m).map(|_| read::<i32>()).collect::<Vec<_>>();
    let ans = solve(n, a);
    println!("{}", ans);
}
