#![allow(unused_imports)]

use std::cell::RefCell;
use std::cmp::{max, min, Ordering};
use std::collections::*;
use std::fmt::{Debug, Formatter, Write as FmtWrite};
use std::io::{stderr, stdin, BufRead, Write};
use std::mem::{replace, swap};
use std::ops::*;
use std::rc::Rc;

// -----------------------------------------------
// Framework <https://github.com/vain0x/procon>
// -----------------------------------------------

//
// Macro debug!
//

#[cfg(debug_assertions)]
include!{"./procon/debug.rs"}

#[cfg(not(debug_assertions))]
macro_rules! debug {
    ($($arg:expr),*) => {};
}

//
// Macro input!
//

macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };

    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };

    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

//
// IteratorExt
//

trait IteratorExt: Iterator + Sized {
    fn vec(self) -> Vec<Self::Item> {
        self.collect()
    }
}

impl<T: Iterator> IteratorExt for T {}





fn main() {
    input! {
        n: isize,
        m: isize,
        xs: [isize; m],
    }

    const M: u64 = 1_000_000_007;

    debug!(xs);

    let has_solution = xs.windows(2).all(|ys| ys[1] - ys[0] >= 2);
    debug!(has_solution);

    if has_solution {
        let first = [-1_isize];
        let last = [n + 1];
        // let xs = [1, 2, 3];
        let xs = first.iter().chain(xs.iter()).chain(last.iter()).vec();
        debug!(xs);
        let ys = xs.windows(2).map(|ys| ys[1] - ys[0] - 1).vec();
        debug!(ys);

        let d = make_d(*ys.iter().max().unwrap() as usize, M);
        debug!(d);

        let ans = ys.iter().map(|y| d[*y as usize]).fold(1, |a, z| (a * z) % M);
        debug!(ans);

        println!("{}", ans);
    } else {
        println!("{}", 0);
    }
}


fn make_d(s: usize, modulo: u64) -> Vec<u64> {
    let mut d = vec![];
    d.resize(s+1, 0);
    d[1] = 1;
    d[2] = 1;
    d[3] = 2;

    for i in 4..(s+1) {
        d[i] = (d[i-1] + d[i-2]) % modulo;
    }

    d
}
