
{-# LANGUAGE BangPatterns #-}

import Data.List
import Data.Int

funcmod :: Int64 -> Int64
funcmod n = n `mod` 1000000007

fib :: Int64 -> Int64
fib i = loop (i+1) 0 1
    where
        loop 0 a !b = a
        loop i a b = loop (i - 1) b (funcmod $ a + b)

solve2 :: Int64 -> Int64 -> [Int64] -> Int64 -> Int64        
solve2 n cur [] result = funcmod $ result * fib (n - cur)

solve2 n cur (i:rest) result
    | cur == i = 0
    | otherwise =
        solve2 n (i+1) rest $ funcmod $ result * fib (i - 1 - cur )

f :: [Int64] -> Int64
f(n:m:l) = solve2 n 0 l 1

main :: IO ()
main = interact $ show.f.map read.words


