from sys import exit
import math
n,m =map(int,input().split())

modn=1000000007

if n==m:
    print(0)
    exit()

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

def step(steps):
    if steps<2:
        return 0
    if steps==2 or steps==3:
        return 1
    max=steps-2

    min=max//2+(1 if steps%2==1 else 0)
    sum=0
    for i in range(min,max+1):
        sum+=c(i,max-i)
    return sum

a=[]
prev=-1
cnt=1
for i in range(m):
    next=int(input())

    cnt*=step(next-prev)%modn
    
    prev=next

cnt*=step(n-prev+1)%modn
print(cnt%modn)
