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)]


from operator import mul
from functools import reduce

def comb(n, r):
    if n - r < r: r = n - r
    if r == 0: return 1
    if r == 1: return n

    numerator = [n - r + k + 1 for k in range(r)]
    denominator = [k + 1 for k in range(r)]

    for p in range(2,r+1):
        pivot = denominator[p - 1]
        if pivot > 1:
            offset = (n - r) % p
            for k in range(p-1,r,p):
                numerator[k - offset] /= pivot
                denominator[k] /= pivot

    result = 1
    for k in range(r):
        if numerator[k] > 1:
            result *= int(numerator[k])

    return result

def stair_count(start,end):
    #print(start,end)
    aida = end - start
    total = 0
    i = aida
    #print("aida/2={}".format(aida/2))
    kazu = 0
    while i >= kazu:
        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)

