N, M = gets.split.take(2).map(&:to_i) if M >= N p 1 elsif N / 2.0 <= M && N.even? p 2 else p -1 end