import math
#N = int(input())
N, M =  map(int,input().split())
#W =list(map(int,input().split()))
a = [(int(input())) for i in range(M)]


def comb(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

def stair_count(start,end):
    #print(start,end)
    aida = end - start
    total = 1
    i = aida-1
    #print("aida/2={}".format(aida/2))
    kazu = 1
    while (aida%2==0 and i >= (aida/2)) or (aida%2!=0 and i>(aida/2)):
        total += comb(i,kazu)
        kazu += 1
        i -= 1
    return total

start = 0
answer = 1
for i in a:
    #print("i={}".format(i))
        if i == start:
            print(0)
            exit()
        else:
            answer = (answer * stair_count(start, i-1))
            start = i+1
answer = (answer * stair_count(start, N))
    #print("answer={}".format(answer))
print(answer%1000000007)
