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

for i in a:
    stp[i-1]=0

cnt=1

for i in range(n):
    if stp[i]==stp[i-1]:
        cnt*=0

if stp[0]!=0:
    cnt*=2

for i in range(2,n):
     if stp[i]!=0 and stp[i-1]!=0 and stp[i-2]!=0:
         cnt*=2

if cnt==0:
    print('0')
else:
    ans=cnt%1000000007
    print(ans)