program main
 integer(16) n,m,i,p
 integer(16), allocatable :: a(:),pat(:)
 
 p=0
 read(*,*) n,m
 if(m==0)then
  p=-1
 end if
 
 if(p==0)then
  allocate(a(1:m),pat(1:n+2))
  read(*,*) a
  do i=1,n
   pat(i)=0
  end do
 
  pat(a(1)+1)=-1
  do i=2,m
   if(a(i)==a(i-1)+1)then
    p=-1
    exit
   end if
   pat(a(i)+1) = -1
  end do
  
  pat(1)=1
  if(p==0)then
   do i=1,n
    if(pat(i)/=-1)then
     if(pat(i+1)/=-1)then
      pat(i+1)=mod(pat(i+1)+pat(i),1000000007)
     end if
     if(pat(i+2)/=-1)then
      pat(i+2)=mod(pat(i+2)+pat(i),1000000007)
     end if
    end if
   end do
  end if
 end if
 
 write(*,*) pat(n+1)
end program main