package yukicoder; import java.util.Scanner; public class Yuki51 { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int w = scan.nextInt(); int d = scan.nextInt(); scan.close(); for(int i = d; i>0; i--){ if(i == 1) { System.out.println(w); break; } try { double num = Math.floor((double)w/((double)i*(double)i)); w -= (int)num; } catch (Exception e) { // TODO: handle exception System.out.println(e); } } } }