import java.util.*; public class Run { public static void main (String arg[]) { Scanner scan = new Scanner(System.in); int W = scan.nextInt(); int D = scan.nextInt(); if (!match(W, D)) System.exit(1); int yaruki; while (D > 1) { W -= W/(D * D); if (W <= 0) { System.out.println("0"); System.exit(0); } D--; } System.out.println(W); } public static boolean match (int... args) { for (int i : args) { if (i < 1||i > 100000) return false; } return true; } }