N,M=map(int, input().split())
#print(N, M)
Broken=[]
for i in range(M):
  Broken.append(int(input()))

OK = "O"
BRO = "B"

K = ""
N += 1
for i in range(N):
  if i in Broken:
    K += BRO 
  else:
    K += OK
    
#print(K)

if BRO+BRO in K:
  print(0)
else:
  #count = 1;
  b = 0;
  for i in range(N):
    if i < N-2:
      if K[i] == OK and K[i+1] == OK and K[i+2]==OK:
        #count *= 2
        b += 1
  #print(2**b)
  #print(count)
  count = 2**b
  print(count % 1000000007)
  