import math
import collections as c
def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

n,m=map(int,input().split())
a = [-1]+[int(input()) for _ in range(m)]+[n+1]

def comb(dann):
    num_comb = 0
    for i in range((dann//2)+1):
        num_comb += combinations_count(dann-i, i)
    return num_comb

danns = c.Counter([(a[i+1] - a[i]) - 2 for i in range(len(a)-1)])

ans = 1
ddict = {}
for j in set(list(danns.keys())):
    ans *= comb(j) ** danns[j]
print(ans%1000000007)