N, M = map(int, input().split())
A = [int(input()) for i in range(M)] 

p = 1
for i in range(N-1):
#  i += 1
  if i in A:
    continue
  elif i+1 in A and i+2 in A:
    p = 0
    break
  elif i+1 in A or i+2 in A:
    p *= 1    
  else:
    p *= 2
    
print(p % 1000000007)
