H, W = map(int, input().split())
S = [int(input()) for _ in range(W)]
    
floor = list(range(0,H+1))
 
if S.count(1) >0:
	floor[1]=0
	floor[2]=1
	if S.count(2) >0:
		floor[2]=0
elif S.count(2) >0:
	floor[1]=1
	floor[2]=0
 
teiou = [0]*H
for i in range (0, H):
	teiou[i] = S.count(i)
    
for i in range (3, H+1):
	if teiou[i-2] == 0 and teiou[i-1]==0:
		print(0)
		quit()
	else:
		floor[i]=floor[i-2]*(1-teiou[i-2])+floor[i-1]*(1-teiou[i-1])

print(floor[H]%(10**9+7))