n, m = gets.split.map(&:to_i) if n.odd? if n > m p -1 else p 1 end else if n / 2 > m p -1 elsif n / 2 <= m && n > m p 2 else p 1 end end