N, M = map(int,input().split())

Lst = list(int(input()) for x in range(M))

Now = 0
cnt = 1

while Now < N:
  if Now + 2 in Lst:
    if not Now + 1 in Lst:
      Now += 1
    else:
      cnt = 0
      break
  elif Now + 1 in Lst:
    if Now + 2 <= N:
      Now += 2
  elif Now + 2 <= N:
    cnt = cnt * 2
    Now += 2
  else:
    cnt = 0
    break

print(cnt % 1000000007)