n,m=map(int, input().split())
a=[0]
for i in range(0,m):
  a = a+[int(input())]
a = a + [n]
ans = 1
for i in range(0,m+1):
  ans = (ans * (a[i+1] - a[i] - 1)) % 1000000007
 
print(ans)

def solve(n):
  if n == 0:
    ans = 0
  elif n == 1:
    ans = 1
  elif n == 2:
    ans = 2
  else:
    ans = solve(n-1) + solve(n-2)
  return ans