N, M = map(int, input().split())
mList = []
for m in range(M):
  num = int(input())
  if num - 1 in mList:
    print("0")
    exit()
  mList.append(num)

l = [2]*(N-1)
l.append(1)
for i in range(N):
  for m in mList:
    l[m] = 0
    if l[m-1] != 0:
      l[m-1] = 1
    if l[m-2] != 0:
      l[m-2] = 1

cnt = l.count(2)
ans = 1
for i in range(cnt // 5):
  t = 2**5
  ans = (ans * t) % 1000000007

ans = (ans % 1000000007) * (2**(cnt%5)) % 1000000007
print(ans)