import math

def perm(n, r):
    return math.factorial(n) // math.factorial(n - r)

def comb(n, r):
    return perm(n, r) // math.factorial(r)


n, m = map(int, input().split())

A = [int(input()) for _ in range(m)]
for i in range(m - 1):
    if A[i + 1] - A[i] == 1:
        ans = 0
        print(ans)
        exit()

S = []
for a in A:
    S.extend((a - 1, a, a + 1))
S.insert(0, 0)
S.append(n)

ans = 1
for i in range(len(S) - 1):
    r = S[i + 1] - S[i]
    if r > 1:
        c = 0
        t_max = r // 2
        for t in range(t_max + 1):
            c += comb(r - t, t)
        ans *= c

ans %= 10**9 + 7
print(ans)
