from math import factorial

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

def comb(n,r):
  return factorial(n) / factorial(r) / factorial(n - r)

def func(a_p,a_c):
  if a_p == a_c: return 1
  num_steps = a_c - a_p
  r = 0
  result = 0
  for n in range(num_steps,0,-1):
    result += int(comb(n,r))
    r += 1
    if n <= r: break
  return result

a_p = 0
result = 1
for i in range(M):
  a_c = int(input()) - 1
  
  if a_c + 1 == a_p: 
    result *= 0
  result *= func(a_p,a_c)
  a_p = a_c + 2
  
result *= func(a_p,N)
print(result%1000000007)