using System;
using System.Collections.Generic;
using System.Linq;

class Program
{
    public void Solve()
    {
        long W = long.Parse(Console.ReadLine());
        long D = long.Parse(Console.ReadLine());

        while (D != 1)
        {
            W -= W / (D * D);
            D--;
        }

        Console.WriteLine(W);
    }

    static void Main()
    {
        var solver = new Program();
        solver.Solve();
    }
}