import Control.Monad
import Data.List

solve i n (x,y) []     | i > n = mod x 1000000007
                       | otherwise = solve (i+1) n ((x+y),x) []
solve i n (x,y) (a:as) | i > n = mod x 1000000007
                       | i == a = solve (i+1) n (0,x) as
                       | otherwise = solve (i+1) n ((x+y),x) (a:as)
                        
main = do
    [n,m] <- map read . words <$> getLine :: IO [Int]
    as <- sort . map read <$>replicateM m getLine :: IO [Int]
    print $ solve 1 n (1,0) as