(n, m) = gets.chomp.split(' ').map(&:to_i) if m >= n puts '1' elsif m >= (n / 2).to_f.ceil && n % 2 == 0 puts '2' elsif n > m puts '-1' end