import math
def comb(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)]
check = a[:]

a.insert(0,0)
a.append(n)

c = 0
d = [0]*(m+1)
for j in range(m+1):
    c = a[j+1] - a[j] -1
    
    e, f = 0,0
    while c - e*2 >= 0:
        f += comb(c-e,c-2*e)
        e +=1
    d[j] = f
    
    


    
answer = 1
for number in range(m+1):
    answer *= d[number]

ch = 1
for k in range(m-1):
    if check[k] == check[k+1] - 1:
        ch =0


if ch == 0:
    print(0)
else:
    print(answer % (10**9+7))