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

modn=1000000007

prev=-1
cnt=1
for i in range(m+1):
    next=0

    if i==m:
        next=n+1
    else:
        next=int(input())

    steps=next-prev
    if steps<2:
        cnt= 0
    elif steps==2 or steps==3:
        None
    else:
        max=steps-2

        min=max//2+(1 if steps%2==1 else 0)
        sum=0
        for i in range(min,max+1):
            sum+=factorial(i) // (factorial(i*2 - max) * factorial(max-i))
        cnt*=sum%modn
    
    prev=next

print(cnt%modn)
