def comb(start, end):
  dist = end - start
  if dist%2 == 0:
    step = dist/2
    return 2**step
  else:
    step = int(dist/2)
    return (2**step) *(step + 1)

N, M = map(int, input().split())
startpoint = 1
result = 1

for i in range(M):
  ai = int(input())
  if ai == 1:
    startpoint = 2
    continue
  if ai <= startpoint:
    result = 0
    break
  endpoint = ai - 1
  result *= comb(startpoint, endpoint)
  startpoint = ai + 1
  print(result)
  
result *= comb(startpoint, N)
print(int(result % 1000000007))