import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); long A = Integer.parseInt(sc.next()); long B = Integer.parseInt(sc.next()); long cnt = 0; if (A > B) { for (long i = A + 1; i <= 2000000000; i++) { cnt++; } } else { cnt = B - A -1; } System.out.println(cnt); } }