use proconio::{fastout, input};

#[fastout]
fn main() {
    input! {
        n: usize,
        m: usize,
        a: [u128; m]
    };
    let a: Vec<u128> = a;

    let base = (10i32.pow(9) + 7) as u128;
    let mut result = 1;

    let f = |x: u128| -> u128 {
        if x <= 2 {
            return 1;
        } else {
            let n = x - 2;
            let i = 2;
            let tmp = (n * (n - 1)) / 2;

            return i + tmp;
        }
    };

    let mut prev = n as u128;

    for i in 0..=m {
        if i < m {
            if prev + 1 == a[i] {
                result = 0;
                break;
            }
        }

        if i == 0 {
            let x = a[i];
            let r = f(x);
            result *= r;
            result %= base;
            prev = a[i];
        } else if i == m {
            let x = n as u128 - a[m as usize - 1];
            let r = f(x);
            result *= r;
            result %= base;
        } else {
            let x = a[i] - a[i - 1] - 1;
            let r = f(x);
            result *= r;
            result %= base;
            prev = a[i];
        }
    }

    println!("{}", result % base);
}
