package yukicoder; import java.util.Scanner; public class No_051 {// やる気の問題 public static void main(String[] args) { Scanner sc = new Scanner(System.in); int W = sc.nextInt(); int D = sc.nextInt(); sc.close(); for (int i = D; i > 1; i--) { int tmp = (W / (int) (Math.pow(i, 2))); W -= tmp; } System.out.println(W); } }