n,k=gets.split.map(&:to_i) if k >= n puts 1 elsif (n % 2 == 0 && k >= n / 2) puts 2 else puts -1 end