n, m = map(int, input().split())
t_list = []
for _ in range(m):
  t = int(input())
  t_list.append(t)
i = 0
s_a = 0
flg = False
ans = 1
for j in range(m):
  if j < len(t_list)-1 and (t_list[j+1] - t_list[j]) == 1:
    ans = 0
    flg = True
    break
  if t_list[j] == 1 and i-2 not in t_list[j-1]:
    s_a += 1
  else:
    s_a += 2
  print(s_a)
if not flg:
  ans = 2 ** (n - s_a - m - 1)
  if ans < 1:
    ans = 1
    
print(ans % 1000000007)