import sys
input=sys.stdin.readline

n,m=map(int,input().split())
S=[]
now=0
for i in range(m):
    a=int(input())
    if i==0 and a==1:
        now=a
        continue
    elif i==0:
        S.append(a-now)
        now=a
        continue
    elif i!=0 and a-now==1:
        print(0)
        sys.exit()
    S.append(a-now-1)
    now=a
S.append(n-now)

mod=10**9+7
N=10**5+10
g1=[1,1]
g2=[1,1]
inverse=[0,1]

for i in range(2,N+1):
    g1.append((g1[-1]*i)%mod)
    inverse.append((-inverse[mod%i]*(mod//i))%mod)
    g2.append((g2[-1]*inverse[-1])%mod)

def cmb(n,r):
    if (r<0 or r>n):
        return 0
    r=min(r,n-r)
    return g1[n]*g2[r]*g2[n-r]%mod


ans=1

for s in S:
    cnt=0
    for i in range((s-1)//2+1):
        cnt+=cmb(s-i-1,i)
        cnt%=mod
    ans=ans*cnt%mod

print(ans%mod)