macro_rules! get {
    ($t:ty) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            line.trim().parse::<$t>().unwrap()
        }
    };
    ($($t:ty),*) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            let mut iter = line.split_whitespace();
            (
                $(iter.next().unwrap().parse::<$t>().unwrap(),)*
            )
        }
    };
    ($t:ty; $n:expr) => {
        (0..$n).map(|_|
                    get!($t)
        ).collect::<Vec<_>>()
    };
    ($($t:ty),*; $n:expr) => {
        (0..$n).map(|_|
                    get!($($t),*)
        ).collect::<Vec<_>>()
    };
    ($t:ty |) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            line.split_whitespace()
                .map(|t| t.parse::<$t>().unwrap())
                .collect::<Vec<_>>()
        }
    };
    ($t:ty | $n:expr) => {
        (0..$n).map(|_| get!($t |)).collect::<Vec<_>>()
    };
}

const MOD: u64 = 1_000_000_007;

fn fac(n: u64) -> u64 {
    if n <= 1 {
        return 1;
    } else {
        return n * fac(n - 1) % MOD;
    }
}

fn count(steps: u64) -> u64 {
    let max_twos = steps >> 1;
    if steps == 0 {
        return 1;
    }
    let mut cnt = 0;
    for twos in 0..(max_twos+1) {
        let ones = steps - twos * 2;
        cnt += (fac(twos + ones) / (fac(twos) * fac(ones))) % MOD;
    }
    cnt % MOD
}

fn main() {
    let (N, M) = get!(u64, u64);
    let mut As = get!(u64; M);
    As.sort();
    let mut cnt = 1;
    let mut pos = 0;
    let mut prev_a = 0;
    for i in 0..As.len() {
        let a = As[i];
        if a == pos || (a == prev_a + 1 && i > 0) {
            println!("0");
            return;
        }
        cnt *= count((a - 1) - pos);
        cnt = cnt % MOD;
        prev_a = a;
        pos = a + 1;
    }
    cnt *= count(N - pos);
    cnt = cnt % MOD;
    println!("{}", cnt);
}
