fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}

#[allow(dead_code)]
fn read_vec2<T: std::str::FromStr>(n: u32) -> Vec<Vec<T>> {
    (0..n).map(|_| read_vec()).collect()
}

fn fib(x: u64) -> u64 {
    let mut a = 1;
    let mut b = 1;

    for _ in 1..x {
        b = a + b;
        a = b - a;
    }
    a
}

#[test]
fn test_fib() {
    assert_eq!(fib(1), 1);
    assert_eq!(fib(2), 1);
    assert_eq!(fib(3), 2);
    assert_eq!(fib(4), 3);
    assert_eq!(fib(5), 5);
    assert_eq!(fib(6), 8);
    assert_eq!(fib(7), 13);
}

fn run(n: u64, m: u64, a: &mut Vec<u64>) {
    let mut b = Vec::new();

    // check
    for i in 0..m {
        let j = i as usize;

        if j == 0 {
            if a[j] == 1 {
                continue;
            } else {
                b.push(a[0])
            }
        }

        if j < (m - 1) as usize {
            let sub = a[j + 1] - a[j];
            if sub == 1 {
                println!("0");
                return;
            } else {
                b.push(sub);
            }
        } else {
            let sub = n - a[j];
            b.push(sub);
        }
    }

    let ans = b.iter().map(|&x| fib(x)).fold(1, |acc, y| acc * y);
    println!("{}", ans % 1000000007);
}

fn main() {
    let v = read_vec::<u64>();
    let n = v[0];
    let m = v[1];
    let mut a = Vec::new();
    for i in 0..m {
        let ai = read::<u64>();
        a.push(ai);
    }

    run(n, m, &mut a);
}
