program typical_stairs

 implicit none
 integer(8)::n,m,i,j,tmp,count_2,ans,answer
 integer(8),allocatable::a(:)
 integer(8),parameter::waru=1000000007

 read*,n,m
 allocate(a(1:m+1))
 read*,a(1:m)
 !print*,a(1:m)

 a(m+1)=n+1
 ans=0
 ans=ans+2**(a(1)/2)
 print*,ans

 do j=2,m+1
  tmp=a(j)-a(j-1)-1
  print*,tmp
  if(tmp==0) go to 200
  count_2=tmp/2
  ans=ans*(2**count_2)
  !print*,ans
 end do
  
 go to 300

200 ans=0

300 if(ans<waru) then 
      print*,ans
    else 
      answer=mod(ans,waru)
      print*,answer
    end if

end program typical_stairs