
def main():
    import sys
    input = sys.stdin.readline
    n,m = map(int,input().split())
    a=[]
    for i in range(m):
        a.append(int(input()) )
    mod=10**9 + 7
    
    def cmb(n, r, m,g1,g2):
        if ( r<0 or r>n ):
            return 0
        r = min(r, n-r)
        return g1[n] * g2[r] * g2[n-r] % m
    
    def nCrMOD(n,r,m):
        g1 = [1, 1]
        g2 = [1, 1]
        inverse = [0, 1]
        for i in range( 2, n + 1 ):
            g1.append( ( g1[-1] * i ) % m )
            inverse.append( ( -inverse[m % i] * (m//i) ) % m )
            g2.append( (g2[-1] * inverse[-1]) % m )
        return cmb(n,r,m,g1,g2)
    
    
    c=0
    for i in range(m-1):
        if a[i]==a[i+1]-1: c+=1
    if c!=0:
        print(0)
    elif m==0:
         print( sum( nCrMOD(n-i,i,mod) for i in range(n//2+1) )%mod )
        
        
    else:
        b=[a[0]-1] + [a[j+1]-a[j]-2 for j in range(m-1)] + [n-a[-1]-1]
        cc=[ sum( nCrMOD(bb-i,i,mod) for i in range(bb//2+1) )%mod for bb in b ]
    
        ans=1
        for ccc in cc:
            ans = ans*ccc%mod
        print(ans)
if __name__ == '__main__':
    main()