import math
import sys

n, m = map(int, input().split())
a_list = [None] * (m + 2)
a_list[0] = -1
for i in range(m):
    a_list[i+1] = int(input())
a_list[-1] = n + 1

fact_memo = dict()
def fact(n):
    if n in fact_memo.keys():
        return fact_memo[n]
    f = math.factorial(n)
    fact_memo[n] = f
    return f

memo = dict()
ans = 1
cur = a_list[0]
for a in a_list[1:]:
    sub = a - cur - 2
    cur = a
    if sub <= 1:
        if sub == -1:
            print(0)
            sys.exit()
        continue
    if sub in memo.keys():
        ans *= memo[sub]
        continue
    count = sum(fact(sub - j) // fact(j) // fact(sub - j*2) for j in range(sub // 2 + 1))
    memo[sub] = count
    ans *= count
print(ans % 1000000007)
