import scala.io.StdIn.* @main def main = val Array(n, k) = readLine().split(' ').map(_.toInt) if n == 1 || k + 1 == n then println(n) else println(n - 1)