import sys
input = sys.stdin.readline

a=[]
n,m = map(int, input().split())
for _ in range(m):
        a.append(int(input()))

for i in range(m-1):
        if a[i+1] - a[i] ==1:
                print(0)
                exit()

ans = (a[0]-1)//2 + 1

for i in range(1,m):
        tmp = a[i]-a[i-1] - 1
        
        ans *= tmp//2 + 1
        print("i: "+str(i))
        print("tmp: "+str(tmp))
        print("ans: "+str(ans))
        print("------------")
ans *= (n - a[-1])//2 + 1
print(ans%(10**9+7))