package main

import (
	"fmt"
	"sort"
)

const mod = 1000000007
var arr []int

func main() {
	var n, m int
	fmt.Scan(&n, &m)
	arr = make([]int, m)
	for i := 0; i < m; i++ {
		fmt.Scan(&arr[i])
	}
	sort.Ints(arr)
	sum, impossible := 1, false
	for i := 0; i < n; i++ {
		if contains(i) {
			continue
		}
		if impossible {
			break
		}
		next1, next2 := contains(i + 1), contains(i + 2)
		if !next1 && !next2 && i + 1 <= n && i + 2 <= n {
			sum *= 2
		} else if (next1 && next2) && (i + 1 <= n && i + 2 <= n) {
			sum = 0
			impossible = true
		}
		sum %= mod
	}
	fmt.Println(sum % mod)
}

func contains(x int) bool {
	idx := sort.SearchInts(arr, x)
	if idx >= len(arr) {
		return false
	}
	return x == arr[idx]
}