N, M = map(int, input().split())
MOD = 10 ** 9 + 7
s = 0

def comb(n, k):
  if k > n - k:
    k = n - k
  de = 1
  nu = 1
  for i in range(k):
    de *= (n - i)
    de = de % MOD
    nu *= (i + 1)
    nu = nu % MOD
  nu = pow(nu, -1, MOD)
  return (de * nu) % MOD

ans = 1

for i in range(M):
  temp = 0
  l = int(input()) - 1
  if s > l:
    print(0)
    exit()
  step = l - s
  for j in range(1 + (step // 2)):
    temp += comb(step-j, j)
    temp = temp % MOD
  ans *= temp
  ans = ans % MOD
  s = l + 2
l = N
step = l - s
temp = 0
for i in range(1 + (step // 2)):
  temp += comb(step-i, i)
  temp = temp % MOD
ans *= temp
ans = ans % MOD

print(ans)