n, m = map(int, input().split())
a = [int(input()) for _ in range(m)]
ans = 1
MOD = 10**9+7
MAX = 10**5+1
fact = [1] * MAX

for i, j in zip(a[:m-1], a[1:]):
    if j - i == 1:
        print(0)
        exit()

def comb_init():
    fact[0], fact[1] = 1, 1
    for i in range(2, MAX):
        fact[i] = fact[i-1] * i

def comb(n, r):
    return (fact[n]%MOD) * pow(fact[r], -1, MOD) * pow(fact[n-r], -1, MOD) 

def f(k):
    idx = k // 2
    num = 0
    for i in range(1, idx+1):
        num += comb(k-i, i)
        num %= MOD
    return num+1

comb_init()
for i in range(m+1):
    left = 0 if i == 0 else a[i-1] + 1
    right = n if i == m else a[i] - 1
    between = right - left
    ans *= f(between)
    ans %= MOD
print(ans)