import sys
import math 
n,m=map(int,input().split())
a=[]
for i in range(m):
    b=int(input())
    if b-1 in a:
        print(0)
        sys.exit()
    else:
        a.append(b)
        
state=0
step=0
ans=0

bunnbo=lambda n,r: math.factorial(r)*math.factorial(n-r)
bunshi=lambda n: math.factorial(n)

for i in range(m):
    temp=0
    step=(a[i]-1)-state
    
    for j in range(step//2+1):
        temp+=(bunshi(step-j)//bunnbo(step-j,j))
    print(temp)
    
    if i==0:
        ans+=temp
    else:
        ans*=temp
    
    state=a[i]+1
    
    if i==m-1:
        temp=0
        step=n-state
        for j in range(step//2+1):
            temp+=(bunshi(step-j)//bunnbo(step-j,j))
        
        print(temp)
        ans*=temp
            
print(ans%(10**9+7))

        
