n, m = map(int,input().split())
a = [int(input())-1 for i in range(m)]
l = [True]*(n+1)
count = 1
for i, v in enumerate(l,0):
  if i in a:
    l[i+1] = False
for i in range(len(l)-2):
  if l[i] == True and l[i+1] == True and l[i+2] == True:
    count *= 2
  elif l[i] == True and l[i+1] == True and l[i+2] == False:
    count *= 1
  elif l[i] == True and l[i+1] == False:
    count *= 1
  elif l[i] == False and l[i+1] == True:
    continue
  elif l[i] == False and l[i+1] == False:
    count = 0
    break
print(count%1000000007)  