import java.util.Scanner
import scala.collection.mutable
object Main extends App {
    val sc = new Scanner(System.in)
    val n = sc.nextInt()
    val m = sc.nextInt() 
    val at = mutable.ListBuffer.fill(m)(sc.nextInt())
    val a = List(0) ++ at ++ List(n)
    var ans = 0
    def ans(n:Int,m: Int,a:Seq[Int]) : Long = {
        val ansL = collection.mutable.ListBuffer.empty[Long]
        ansL += 1
        def partans(n:Int) : Long ={
            if (n == 0) 1
            else if(n==1) 1
            else if(n==2) 2
            else partans(n-1) + partans(n-2)
        }

        for(i<-0 until m+1){
            if(a(i+1)-a(i) == 1 && i != 0 && i != m) {
                println(0)
                sys.exit()
                }else if(a(i+1)-a(i) == 2) {ansL += 1
            }else if(i == 0 || i==m){ansL +=  partans(a(i+1)-a(i)-1)
            }else {ansL +=  partans(a(i+1)-a(i)-2)
            }
        }
        println(ansL)
        ansL.reduce((a,b) =>  a * b)
    }
    println(ans(n,m,a)%1000000007L)
}