n, m = map(int, input().split())
mod = 10**9+7
facs = [1] * (n-m)
invs = [1] * (n-m)
nfac = 1
for i in range(1, n-m):
    nfac = nfac * i % mod
    facs[i] = nfac
    invs[i] = pow(facs[i], mod-2, mod)

ans = 1
start = 0
for i in range(m+1):
    try:
        a = int(input())
        end = a-1
    except:
        end = n
    if start-1 == end:
        print(0)
        break
    # startからendまで行く方法
    t = end-start
    pat = 0
    for j in range(-(-t//2)+1):
        pat += (facs[t-j] * invs[j] * invs[t-j-j]) % mod
    ans *= pat
    ans %= mod
    start = a+1
else:
    print(ans)
