from math import factorial

def cases(idx_start, idx_end):
  cases = 0
  for r in range((idx_end - idx_start)//2+1):
    n = idx_end - idx_start - r
    cases += factorial(n) / factorial(r) / factorial(n - r)
  return cases

n, m  = map(int, input().split())
alist = [int(input()) for i in range(m)]
div_num = 1000000007

ans = cases(1,alist[0])
for i in range(1,m):
  if alist[i] - alist[i-1] <= 1:
    print(0)
    exit()
  ans *= cases(alist[i-1]+1, alist[i])
ans *= cases(alist[-1]+1, n+1)
print(int(ans%div_num))