n, m = gets.split.map &:to_i if n % 2 == 0 puts [n / 2, m + 1].min else puts [n, m + 1].min end