import itertools

N,M=map(int,input().split())
a=[int(input()) for _ in range(M)]

def count_step(n):
    num=n//2
    count=0
    for i in range(num+1):
        step=[]
        for _ in range(n-2*i):
            step.append(1)
        for _ in range(i):
            step.append(2)
        count+=len(list(itertools.combinations(step,i)))
    return count

a2=[a[0]-1]

for i in range(M-1):
    p=a[i+1]-a[i]-2
    
    a2.append(p)

a2.append(N-a[M-1]-1)

p=1
for i in range(M-1):
    if a[i]+1==a[i+1]:
        p=0
        break

if p==0:
    pattern=0
else:
    pattern=1
    for i in range(len(a2)):
        pattern*=count_step(a2[i])

print(pattern%1000000007)