n, m = map(int, input().split())
MOD = 1000000007

fact=[0,1]
fact_inv=[0]*(n+1)
for i in range(2,n+1):
  fact.append(fact[-1]*i % MOD)

fact_inv[n] = pow(fact[n],MOD-2,MOD)
for i in range(n-1,-1,-1):
  fact_inv[i] = fact_inv[i+1]*(i+1)%MOD

def comb(n,r):
  return fact[n]*fact_inv[r]*fact_inv[n-r]%MOD

def sigmaComb(dis):
  ans=0
  end=dis//2 if dis%2 != 0 else dis//2+1
  for i in range(end):
    t=comb(dis-i,i)
    ans+=t
  return ans

#print(fact)
#print(fact_inv)
hole=[0]
ans=1
for i in range(m):
  t = int(input())
  if t == hole[-1]+1:
    if hole[-1] == 0:
      hole.append(t)
      continue
    else:
      ans=0
      break
  dis=t-hole[-1]-2
  ans=ans*sigmaComb(dis)%MOD
  hole.append(t)
else:
  dis=n-hole[-1]-2+1
  ans=ans*sigmaComb(dis)%MOD

print(ans%MOD)