import java.util.Scanner; public class Test { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int a = sc.nextInt(), b = sc.nextInt(), c = 2000000000; if (a < b) { System.out.println(b - 2); } else { System.out.println(c - b - 1); } } }