N,M = map(int,input().split())
list = [int(input()) for i in range(M)]

def com(x):
    cnt = 0
    for i in range(x+1):
        for j in range(x//2+1):
            if i + j*2 == x:
                cnt += 1
    return cnt

list_diff = []

for i in range(M):
    if i == 0:
        list_diff.append(list[i]-1)
    else:
        list_diff.append(list[i]-list[i-1]-2)

if list[-1] != N:
    list_diff.append(N-list[-1]-1)

ans = 1

for i in list_diff:
    if i == 0:
        pass
    else:
        ans *= com(i)

print(ans%1000000007)