import java.util.*; public class Main { public static void main(String[] args) throws Exception { Scanner sc = new Scanner(System.in); long A = sc.nextLong(); long B = sc.nextLong(); if(A == 0){ System.out.println(B); }else if(B == 0){ System.out.println(0); }else if(Math.abs(B) % (Math.abs(A)-1) == 0){ if(A < 0){ A = -A; B = -B; } System.out.println(-B/(A-1)); } } }