using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace yukicoder_51 { class Program { static void Main(string[] args) { long w = long.Parse(Console.ReadLine()); long d = long.Parse(Console.ReadLine()); double l; for (; d > 1; d--) { l = w / (d * d); l = Math.Floor(l); w -= (int)l; } Console.WriteLine(w); Console.ReadLine(); } } }