import math
import functools
import operator
N,M= list(map(int,input().split()))
a = []
for i in range(M):
    an = int(input())
    a.append(an)
#print("a=",a)

#実質的に歩く階段の数
toS=N-M
check = 0
#連番の場合存在しない
for i in range(1,M-1):
    if a[i] == a[i-1]+1 or a[M-1] == N:
        check = 1
#        print(0)

#間の階段の数
dela = [a[0]]
for i in range(1,M):
#    print("i=",i)
    delan = a[i]-a[i-1]
    dela.append(delan)

dela.append(N-a[M-1])
#("dela=",dela)


number = 0
#2の個数を選ぶ(dela[i]=4なら(1,1,2),(1,2,1),(2,1,1),(2,2)の組み合わせ
kumiawase = []
for i in range(len(dela)):
    if dela[i] >=3:
        for j in range(dela[i]//2):
            twonum = j+1 #2の個数
            rownum= dela[i]- twonum
#            print("twonum,rownum,j=",twonum,rownum,j,dela[i])
            number = number + (math.factorial(rownum))/(math.factorial(twonum))
        kumiawase.append(int(number))
        number = 0
#    print("i,delalen=",i,len(dela))
#print("kumiawase=",kumiawase)
result = 1
for i in range(len(kumiawase)):
    result =result*kumiawase[i]
if check ==0:
    print(result%1000000007)