import sys
import numpy as np
import math

N, M = list(map(int, input().split()))
A = np.zeros(M)

for i in range(M):
    A[i] = int(input())


# a が連続しているとだめ
for i in range(M-1):
    if A[i] == A[i+1]-1:
        print(0)
        sys.exit()

# 穴同士の間隔を考えて，積を取る
d = np.zeros(M+1)

for i in range(M-1):
    d[i+1] = A[i+1] - A[i] - 2

d[0] = A[0] - 1
d[-1] = N - A[-1] - 1


p = np.zeros(M+1)

for i in range(M+1):

    n = int(d[i] // 2)

    for j in range(1,n+1):
        # 2の数 j個
        # 1の数 n1 = d - 2j
        n1 = d[i] - 2*j
        pp = math.factorial(n1+j)/(math.factorial(j) * math.factorial(n1))
        p[i] += pp

    p[i] += 1

mm = 1000000007
p = p % mm

print(int(np.prod(p) % mm))