program main
  implicit none
  integer::N,M
  read *,N,M
  if (N.eq.2*M .and. (IAND(N,N-1).eq.0)) then
     print '(i0)',2
  else if(N.gt.M) then
     print '(i0)',-1
  else
     print '(i0)',1
  end if
end program main