```go
package main
import (
"fmt"
"sort"
)
const MOD = 1000000007
func main() {
var n, m int
fmt.Scan(&n, &m)
on := make([]int, m)
for i := 0; i < m; i++ {
fmt.Scan(&on[i])
}
sort.Ints(on)
// Precompute factorials and inverse factorials
maxN := n + 10
fact := make([]int64, maxN)
invFact := make([]int64, maxN)
fact[0] = 1
for i := 1; i < maxN; i++ {
fact[i] = fact[i-1] * int64(i) % MOD
}
invFact[maxN-1] = modpow(fact[maxN-1], MOD-2, MOD)
for i := maxN - 2; i >= 0; i-- {
invFact[i] = invFact[i+1] * int64(i+1) % MOD
}
comb := func(a, b int) int64 {
if b < 0 || b > a {
return 0
}
return fact[a] % MOD * invFact[b] % MOD * invFact[a-b] % MOD
}
// The initially on lights divide the off lights into groups (gaps).
// Gap before first on light, gaps between consecutive on lights, gap after last on light.
//
// Left gap: on[0]-1 lights (indices 1..on[0]-1)
// Middle gaps: on[i]-on[i-1]-1 lights for i=1..m-1
// Right gap: n-on[m-1] lights
//
// For a middle gap of size g, at each step we can extend from left or right end,
// so there are 2^(g-1) orderings within that gap (if g>0).
// For left/right gaps, we must fill from the side adjacent to the on light,
// so there's exactly 1 ordering within each.
//
// Then we need to interleave all gaps together using multinomial coefficient.
// Total off lights = n - m.
// The answer = multinomial(n-m; sizes of gaps) * product of 2^(middle_gap_size - 1)
gaps := make([]int, 0)
// left gap
leftGap := on[0] - 1
if leftGap > 0 {
gaps = append(gaps, leftGap)
}
// middle gaps
middlePow := int64(1)
for i := 1; i < m; i++ {
g := on[i] - on[i-1] - 1
if g > 0 {
gaps = append(gaps, g)
middlePow = middlePow * modpow(2, int64(g-1), MOD) % MOD
}
}
// right gap
rightGap := n - on[m-1]
if rightGap > 0 {
gaps = append(gaps, rightGap)
}
total := n - m
// multinomial coefficient: total! / (g1! * g2! * ... * gk!)
// We can compute this as successive combinations
ans := middlePow
remaining := total
for _, g := range gaps {
ans = ans % MOD * comb(remaining, g) % MOD
remaining -= g
}
fmt.Println(ans % MOD)
}
func modpow(base, exp, mod int64) int64 {
base %= mod
result := int64(1)
for exp > 0 {
if exp%2 == 1 {
result = result * base % mod
}
base = base * base % mod
exp /= 2
}
return result
}
```