program gcd_main
  implicit none
   integer,allocatable::a(:)
   integer::m,n,i,k,ans
   read*,m,n
   allocate(a(n))
   read(*,*)(a(i),i=1,n)
   do i=1,n
	a(i)=a(i)/2
   end do
   ans=a(i)
   do i=2,n-1
    k=gcd(ans,a(i))
   	ans=ans*a(2)/k
  ans=m/ans
  if(mod(ans)==1)then
  	print*,(ans+1)/2
  else 
  	print*,ans/2
  stop
contains
  integer function gcd(a, b)
    implicit none
    integer, intent(IN) :: a, b
    integer :: l, m, n
    m = a
    n = b
    do
      l = mod(m, n)
      if (l == 0) exit
      m = n
      n = l
    end do
    gcd = n
    return
  end function gcd
end program gcd_main