import itertools as it
def X (n):
    if n%2==0:
        r=n//2
    else:
        r=(n-1)//2
    S=1
    C=1
    for j in range(1,r+1):
        C=len(list(it.combinations(range(n-j),j)))
        S+=C
    return int(S)

N,M=map(int,input().split())
L=[]
a=0
for i in range(M):
    b=int(input())
    L.append(b-a-1)
    a=b
L.append(N-b-1)
A=1
mod=10**9+7
for i in range(len(L)):
    A*=(X(L[i])%mod)
    if L[i]==0 and i>0:
        A=0
        break
print(A%mod)