package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

func main() {
	var n, m int
	fmt.Scan(&n, &m)
	var (
		sc    = bufio.NewScanner(os.Stdin)
		a, ba int
		ans   = 1
	)
	for i := 0; i < m; i++ {
		sc.Scan()
		a, _ = strconv.Atoi(sc.Text())
		if a == ba {
			continue
		} else if a-ba == 1 && ba != 0 {
			fmt.Println(0)
			return
		}
		for j := 0; j < a-ba-2; j++ {
			ans = (ans * 2) % 1000000007
		}
		ba = a
	}
	for i := 0; i < n-a-2; i++ {
		ans = (ans * 2) % 1000000007
	}
	fmt.Println(ans)
}
