package main

import "fmt"

func main() {
	var n, m int
	fmt.Scan(&n, &m)
	a := make([]int, m)
	for i := 0; i < m; i++ {
		fmt.Scan(&a[i])
	}

	for i := 0; i < m-1; i++ {
		if a[i+1] == a[i] || a[i+1] == a[i]+1 {
			fmt.Println(0)
			return
		}
	}

	s := make([]int, n+1)
	s[0] = 1
	s[1] = 1
	for i := 2; i <= n; i++ {
		s[i] = s[i-1] + s[i-2]
	}

	ans := 1
	for i := 0; i < m; i++ {
		if i == 0 {
			ans *= s[a[i]-1]
			ans %= 1000000007
		} else {
			ans *= s[a[i]-1-(a[i-1]+1)]
			ans %= 1000000007
		}
	}
	ans *= s[n-a[m-1]-1]
	ans %= 1000000007
	fmt.Println(ans)
}
