import numpy as np
from math import factorial
import math, sys

N, M = map(int, input().split())
A = [None]*M

for i in range(M):
    A[i] = int(input())

tmp = 0
x = []

for i, a in enumerate(A):
    x.append(a-tmp-1)
    tmp = a + 1

x.append(N - tmp)
    
x = np.array(x)
if x[1:].min()<1:
    print(0)
    sys.exit()

def calc_combi(a):
    ans = 0
    for i in range(int(a/2)+1):
        tmp_n = math.ceil(a/2)+i
        tmp_r = a - tmp_n
        ans += factorial(tmp_n) // factorial(max(tmp_r, tmp_n - tmp_r))                        
    return ans

memo =  list(map(lambda x: calc_combi(x), x))

ans = 1
for m in memo:
    ans = ans * m % 1000000007

print(ans)