path = 1
a_num = 0
now = 0
N,M = map(int,input().split(' '))
flag = 1
if a_num < M:
  next_a = int(input())
  a_num += 1
else:
  next_a = -1
if a_num < M:
  next_a2 = int(input())
  a_num += 1
else:
  next_a2 = next_a
while(now<N-1):
  if now+1 == next_a and now+2 == next_a2:
    path = 0
    break
  elif now+1 == next_a:
    next_a = next_a2
    if a_num < M:
      next_a2 = int(input())
      a_num += 1
    now += 2
  elif now+2 == next_a:
    now += 1
  elif now+1 != next_a and now+2 != next_a:
    path *= 2
    now += 2

if path != 0 and now+1 == next_a:
  print(path % 1000000007)
elif path != 0 and now+1 !=next_a:
  print(path*2 % 1000000007)
elif path == 0:
  print(path % 1000000007)