def combi(N,R):
  res = 1
  for r in range(R):
    res *= (N-r)/(R-r)
  return int(res)
  
def calc_pat(K):
  res = 0
  Mmax = int(K/2)
  for M in range(Mmax+1):
    N=K-M*2
    res = res+combi(M+N,M)
  return res

NMAX = 1000000007
N,M = map(int,input().split())

S=[0]*M

flg = False
for n in range(M):
  S[n] = int(input())
  if n>0 and S[n-1]+1==S[n]:
    flg = True

if flg:
  print(0)
else:
  res = 1
  for n in range(M):
    if n==0:
      K = S[n]-1
    else:
      K = S[n]-S[n-1]-2

    if K>1:
      res = (res*calc_pat(K))%NMAX
      
  K = N - S[n] -1
  res = (res*calc_pat(K))%NMAX
  
  print(res)
  

