// yukicoder My Practice // author: Leonardone @ NEETSDKASU use std::io; fn main() { let mut w_str = String::new(); let mut d_str = String::new(); io::stdin().read_line(&mut w_str).ok().expect(""); io::stdin().read_line(&mut d_str).ok().expect(""); let mut w : u64 = w_str.trim().parse().ok().expect(""); let mut d : u64 = match d_str.trim().parse() { Ok(num) => num, Err(_) => return, }; for _ in 1..d { let t : u64 = w / (d * d); w -= t; d -= 1; } println!("{}",w); }