N,M = map(int, input().split())
a = [-1]+[int(input()) for _ in range(M)]+[N+1]
mod = 10**9+7
fact = [1]+[0]*N
finv = [1]+[0]*N
for i in range(1,N+1):
    fact[i] = fact[i-1]*i % mod
    finv[i] = pow(fact[i], mod-2, mod)

def cmb(a,b):
    n = max(a,b)
    r = abs(a-b)
    if not n or min(a,b) < 0:
        return 0
    else:
        return fact[n]*finv[n-r]*finv[r] % mod
ans = 1
for i in range(1,M+2):
    if a[i] == 1:
        continue
    elif a[i] == N and a[i-1] == N-1:
        continue
    b = a[i]-a[i-1]-2
    ansp = 0
    for j in range(b - (b+1) // 2 + 1):
        ansp = (ansp + cmb(b-j, j)) % mod
    ans = ans * ansp % mod

print(ans)