import java.util.ArrayList

lateinit var cache: LongArray

fun main(args: Array<String>) {
    val (n, m) = readLine()!!.split(" ").map(String::toInt)
    val a = IntArray(m)
    repeat(m) { i ->
        a[i] = readLine()!!.toInt()
    }

    cache = LongArray(n + 1)

    if (m == 0) {
        println(countPattern(n))
        return
    }

    if (isImpossible(a)) {
        println("0")
        return
    }

    val separated = ArrayList<Int>()
    var prev = a[0]
    separated.add(prev - 1)
    for (i in 1 until m) {
        val curr = a[i]
        separated.add(curr - prev - 2)
        prev = curr
    }
    separated.add(n - prev - 1)
    val filtered = separated.filter { it -> it > 0 }

    var ans: Long = 1
    for (s in filtered) {
        ans *= countPattern(s)
    }
    println(ans % 1000000007)
}

private fun isImpossible(a: IntArray): Boolean {
    for (i in 0 .. a.size - 2) {
        if (a[i] + 1 == a[i + 1]) {
            return true
        }
    }
    return false
}

private fun countPattern(steps: Int): Long {
    if (steps < 3) return steps.toLong()

    val cached = cache[steps]
    if (cached != 0L) {
        return cached
    }

    val result = countPattern(steps - 1) + countPattern(steps - 2)
    cache[steps] = result
    return result
}
