package net.ipipip0129.yukicoder.no51;

import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int work = scan.nextInt();
        int end_time = scan.nextInt();

        scan.close();

        for (int i = end_time; 1 < i ; i--) {
            work -= work / (int) Math.pow(i, 2);
        }

        System.out.println(work);
    }
}