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