import math

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


n, m = map(int, input().split())
a = [int(input()) for i in range(m)]
b = []
for i in range(m):
    if i == 0:
        b.append(a[i] - 1)
    else:
        b.append(a[i] - a[i - 1] - 2)
b.append(n - a[-1] - 1)
if -1 in b:
    print(0)
    exit()
c = set(b)
d = {}
for i in c:
    k = 0
    s = 1
    while i - k > k:
        s += nCr(i - k, k)
        k += 1
    d[i] = s
ans = 1
for i in b:
    ans *= d[i] % (10 ** 9 + 7)
print(ans % (10 ** 9 + 7))