import java.io.PrintWriter

val pw = PrintWriter(System.out)
fun main(args: Array<String>) {
    func()
    pw.flush()
}
fun println(value: Any) { pw.println(value) }



//ABC129_C
fun func() {
    val (N, M) = listOfInt()
    var A = Array<Int>(M, { nextInt() })
    var K = Array<Boolean>(N+1, { true })
    for (m in 0 until M) K[A[m]] = false
//println("A: ${A.toStringA()}")
//println("K: ${K.toStringB()}")
    var S = Array<Long>(N+1, { 0L })

    for (n in 0 until N) {
        var k = 0L
        if (K[n]) {
            if (n + 1 <= N && K[n + 1]) k++
            if (n + 2 <= N && K[n + 2]) k++
        } else k = 1L
        S[n] =  k
    }
//println("S: ${S.toStringA()}")

    val MOD = 1_000_000_007L
    var ans = 1L
    for (n in 0 until N) {
        when (S[n]) {
            0L -> ans = 0L
            2L -> ans = (ans * 2) % MOD
            else -> { }
        }
    }

    println("${ans}")
}

fun next() = readLine()!!
fun nextInt() = Integer.parseInt(next())
fun listOfString() = next().split(" ")
fun listOfInt() = listOfString().map { Integer.parseInt(it) } //{ it.toInt() }
