{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE TypeFamilies #-}
import           Data.Maybe
import           Data.Int
import           Data.List
import           Data.Char
  -- import qualified Data.Vector.Unboxing as VU
import qualified Data.Vector as V
import qualified Data.Vector.Mutable as VM
import qualified Data.Vector.Unboxed as VU
import qualified Data.Vector.Unboxed.Mutable as VUM
import qualified Data.ByteString.Char8 as BS
import           Data.List (scanl')
import           Data.IORef
import           Control.Monad
import           Control.Monad.ST
import           Control.Monad.State.Strict
import           Control.Applicative
import           Debug.Trace


readInt = BS.readInt . BS.dropWhile isSpace
getVector f = VU.unfoldr f <$> BS.getLine
getIntVector = getVector readInt
getBSVector = getVector BS.uncons

modulus :: Int64
modulus = 10^9+7

addMod :: Int64 -> Int64 -> Int64
addMod x y = (x + y) `mod` modulus
subMod :: Int64 -> Int64 -> Int64
subMod x y = (x - y) `mod` modulus
mulMod :: Int64 -> Int64 -> Int64
mulMod x y = (x * y) `mod` modulus


main = do
  [n,m] <- map read . words <$> getLine :: IO [Int]
  as <- replicateM m $ readLn :: IO [Int]

  print . ans $ solve n as

ans (Just n) = n `mod` (10^9 + 7)
ans  Nothing = 0


solve n as = loop as 0 1
  where
    loop [] nowPlace ways = Just $ ways * (test (n+1) nowPlace)
    loop [a] nowPlace ways = loop [] (a+1) (ways * (test a nowPlace))
    loop (aNext:aNextNext:aList) nowPlace ways = if aNextNext == (aNext+1)
                                       then Nothing
                                       else loop (aNextNext:aList) (aNext+1) (ways * (test aNext nowPlace))


test aNext nowPlace = moveWays
  where
    target = aNext - 1
    l = target - nowPlace
    maxTwoStepTimes = l `div` 2
    moveWays = foldl' (\n m -> n + (f m)) 0 [0..maxTwoStepTimes]
    f m = comb (small+m) m
        where
          small = l - (2*m)

comb x y = (loop1 x y 1) `div` (loop2 y 1)
  where
    loop1 _ 0 n' = n'
    loop1 n r n' = loop1 (n-1) (r-1) (n*n')
    loop2 0 n' = n'
    loop2 n n' = loop2 (n-1) (n*n')
