N,M=map(int,input().split())
a=[]
b=0 in range(N)
for i in range(M):
    a.append(int(input()))
j=M-1
if j>=0 and a[0]==1:
    f1=0
    f2=1
elif j>=0 and a[0]==2:
    f1=1
    f2=1
else:
    f1=1
    f2=2
def f(n,a,j):
    if n>2:
        if j==-1 or ((n-1)!=a[j] and (n-2)!=a[j]):
            return f(n-1,a,j)+f(n-2,a,j)
        if j>0 and a[j]==a[j-1]+1:
            return 0
        if j+1<M and a[j+1]==a[j]+1:
            return 0
        elif (n-1)==a[j]:
            return f(n-2,a,j-1)
        elif (n-2)==a[j]:
            return f(n-1,a,j)
    elif n==1:
        return f1
    else:
        return f2
print(f(N,a,j))