object Main extends App {
  import scala.io.StdIn.readLine

  val in = readLine().split(" ").map(_.toInt)
  val N = in(0);
  val i = in(1);

  val res =
    if (N == i) 1
    else if (i == 1) N
    else N - i + 1

  println(res)
}