n,m=map(int,input().split())
a=[int(input()) for i in range(m)]

pattern=[0]*n
pattern[0]=1
pattern[1]=1
pattern[2]=2

for i in range(3, n):
    pattern[i]=2*pattern[i-2]+pattern[i-3]

judge=False
for i in range(m-1):
    if a[i+1]-a[i]==1:
        judge=True
ans=1
med=0
num=1

if judge:
    print("0")
else:
    for i in range(n):
        if i+1 in a:
            num=0
            ans*=med
    
        else:
            med=pattern[num]
            num+=1


ans*=med

print(ans)
