--{-# LANGUAGE OverloadedStrings #-}
--{-# LANGUAGE OverloadedLists   #-}
{-# LANGUAGE BangPatterns      #-} --引数に!
{-# LANGUAGE MultiWayIf        #-}
{-# LANGUAGE TupleSections     #-}

import Data.Bits
import Data.Foldable (foldlM,foldrM)
import Data.Maybe (fromJust)
import Data.List
--import Data.Matrix.Unboxed
import Data.Array  --変数衝突
import Data.Array.Unboxed
import Data.Array.MArray
import Data.Array.ST
import Data.Graph
--import Data.Vector as V　--変数衝突
import qualified Data.Vector.Unboxed as V
import Control.Monad
import Control.Monad.State
import Control.Monad.ST
import qualified Data.ByteString.Lazy.Char8 as B
--import Debug.Trace

type Ans = Int
type DP s = STUArray s Int Int

modifyArray :: (MArray a e m ,Ix i) => a i e -> i -> (e -> e) -> m ()
modifyArray arr i f =  readArray arr i >>= writeArray arr i . f

dp_i :: DP s -> Int -> Int -> [Int] -> ST s ()
dp_i dparr n i [] | i >= n = return ()
                  | otherwise = do
                    v <- readArray dparr i
                    modifyArray dparr (i+1) (\x -> mod' $ x+v)
                    modifyArray dparr (i+2) (\x -> mod' $ x+v)
                    dp_i dparr n (i+1) []
dp_i dparr n i (a:as) = do
  if (i == a) then dp_i dparr n (i+1) as
    else do
      v <- readArray dparr i
      modifyArray dparr (i+1) (\x -> mod' $ x+v)
      modifyArray dparr (i+2) (\x -> mod' $ x+v)
      dp_i dparr n (i+1) (a:as)

solve :: Int -> Int -> [Int] -> ST s Ans
solve n m as = do
  dparr <- newArray (0,n+1) 0
  writeArray dparr 0 1
  dp_i dparr n 0 as
  readArray dparr n

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

  print $ mod' $ runST $ solve n m as

mod' :: Int -> Int
mod' n = if n < 1000000007 then n else mod n 1000000007
