import Control.Applicative
import Control.Monad
import qualified Data.List
import qualified Data.Char
import Debug.Trace
import qualified Data.Sequence as Seq

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

solve :: Int -> [Int] -> Int
solve n as =
  -- traceShow (take n cands) $
  ans
  where
    isBrokenL = brokenListToBool as [0..]
    cands =  dp f $ tail isBrokenL
    ans = cands !! (n+1)

f isBroken prevCombo prevPrevCombo =
  -- traceShow cand $
  cand
  where
    cand =
      if isBroken then 0
      else prevCombo + prevPrevCombo  `mod` 1000000007

-- brokenListToBool [] [] = []
brokenListToBool [] _ = repeat False -- False : brokenListToBool [] bs' 
brokenListToBool as@(a:as') (b:bs') 
  | a==b =  True : brokenListToBool as' bs'
  | otherwise = False : brokenListToBool as bs'
  

-- functions --

dp f l =
  combos
  where
    combos = 0 : 1 : zipWith3 f l combos (tail combos)
