'use strict'

function Main(input) {
  const N = Number(input.split("\n")[0].split(" ")[0])
  const M = Number(input.split("\n")[0].split(" ")[1])
  const a = input.split("\n").slice(1).map(x => Number(x))
  
  if (a.length > 1) {
    for (let i=1; i<M; i++) {
        if(a[i] - a[i-1] === 1) {
            console.log(0)
            return
        } 
    }
  }
  
  const list = []
  for(let i=0; i<=M; i++) {
    if(i === 0) {
        list.push(a[i] - 1)
        continue
    }
    if(i === M) {
        list.push(N - a[i-1] - 1)
        continue
    }
    list.push(a[i] - a[i-1] - 2)
  }

  let ans = 1
  for(let i=0; i<M+1; i++) {
      ans = (ans * fib(list[i])) % 1000000007
  }

  console.log(ans)

}

Main(require("fs").readFileSync("/dev/stdin", "utf8").trim())

function fib(x) {
    if(x === 1 || x === 0) {
        return 1
    }
    if(x === 2) {
        return 2
    }
    let last = 2
    let second = 1
    for(let i=3; i<=x; i++) {
        let total = (last + second)
        second = last
        last = total
    }
    return last
}
