using System; public class Program { public static void Main() { int w = int.Parse(Console.ReadLine()); int d = int.Parse(Console.ReadLine()); for (int i = d; i > 1; i--) { int t = w / (i * i); w -= t; } Console.WriteLine(w); } }