from math import factorial
def c(n):
    c = 0
    if n != 0:
        for i in range(n):
            if n - i < i:
                pass
            else:
                x = n - i
                r = i
                c += factorial(x) / factorial(r) / factorial(x - r)
    return c
N, M = map(int,input().split())
ans = 1
pre_a = 0
for j in range(M+1):
    if j != M:
        a = int(input())

    else:
        if pre_a != N-1:
            a = N
        else:
            a = N+1
    n = a - pre_a - 1
    if a == 1:
        ans *= 1
    else:
        ans *= c(n)
    pre_a = a
print(int(ans%1000000007))