program main
 implicit none
 integer(16) n,m,i
 integer(16), allocatable :: a(:),pat(:)
 
 read(*,*) n,m
 if(m==0)then
  write(*,*) 0
  stop
 end if
 
 allocate(a(1:m),pat(1:n+2))
 read(*,*) a
 do i=1,n+2
  pat(i)=0
 end do
 
 pat(a(1)+1)=-1
 do i=2,m
  if(a(i)==a(i-1)+1)then
   write(*,*) 0
   stop
  end if
  pat(a(i)+1) = -1
 end do
  
 pat(1)=1
 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
 
 write(*,*) pat(n+1)
end program main