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

res = 1
for i in range(1, len(a)):
    if a[i] == 1:
        continue
    tmp = a[i] - a[i-1] - 2
    if tmp < 0:
        tmp2 = 0
    elif tmp <= 1:
        tmp2 = 1
    elif tmp <= 2:
        tmp2 = 2
    else:
        tmp2 = 2
        for j in range(1, tmp-1):
            tmp2 += j
    res *= tmp2
    res %= 1000000007

print(res)
