import math
N,M = [int(x) for x in input().split()]
a = [int(input()) for j in range(M)]

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

def keisan(a,b):
    count = 0
    n = b - a - 1
    r = 0

    while n >= r:

        count += combination(n,r)
        n -= 1
        r += 1

    return count

result = 1

for i in range(M):


    if i == 0:
        result *= keisan(0,a[i])
        continue

    #階段の段が連続して壊れている場合は登れない
    if a[i] - a[i-1] == 1:
        result = 0
        break
    else:
        result *= keisan(a[i-1],a[i])

else:
    result *= keisan(a[M-1],N)

print(int(result)%1000000007)
