from collections import Counter
n, m = map(int, input().split())
l = []
a0 = 0
for i in range(m):
    a = int(input())
    if a - a0 == 0:
        print(0)
        exit()
    l.append(a - a0 - 1)
    a0 = a + 1
l.append(n - a0)
d = Counter(l)
key = list(d.keys())

def cmb(n, r):
    if r > n//2:
        r = n - r
    val = 1
    for i in range(r):
        val *= n - i
        val //= i + 1
    return val

ans = 1
for k in key:
    val = 0
    for i in range(k//2 + 1):
        val += cmb(k - i, i)
        val %= 10**9 + 7
    ans *= val**d[k]
    ans %= 10**9 + 7
print(ans)