import sys
sys.setrecursionlimit(100000)
nCr = {}
def cmb(n, r):
  if r == 0 or r == n: return 1
  if r == 1: return n
  if (n,r) in nCr: return nCr[(n,r)]
  nCr[(n,r)] = cmb(n-1,r) + cmb(n-1,r-1)
  return nCr[(n,r)]

def calc(x):
  total = 1
  m = x // 2
  for i in range(1, 1+m):
    t = cmb((x-i), i)
    total += t
  # print((x, total))
  return total

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

total = 1
b = int(input())
total *= calc(b-1)

for _ in range(m-1):
  a = int(input())
  t = a - b - 1
  b = a
  if t == 0:
    total = 0
    break
  total *= calc(t)

total *= calc(n-b-1)

print(total % 10000000007)
