use std::io::Read; fn r(w: u32, d: u32) -> u32 { match d { 1 => w, _ => r(w.saturating_sub(w / d.pow(2)), d - 1), } } fn main() { let mut s = String::new(); std::io::stdin().read_to_string(&mut s).ok(); let n: Vec = s.split_whitespace().flat_map(str::parse).collect(); println!("{}", r(n[0], n[1])); }