fn main() { let mut nm = String::new(); std::io::stdin().read_line(&mut nm).ok(); let nm: Vec = nm.trim().split_whitespace().map(|s| s.parse().unwrap()).collect(); let n = nm[0]; let m = nm[1]; let mut b = String::new(); std::io::stdin().read_line(&mut b).ok(); let mut b: Vec = b.trim().split_whitespace().map(|s| s.parse().unwrap()).collect(); if m == 1 { println!("{}", n-1); return; } let result = n - b[m-1] + b[0] - 1; let result = result as f64; b.reverse(); let mut summary = vec![0usize; m]; for i in 0..m-1 { summary[i+1] = summary[i] + b[i] - b[i+1]; } let mut sumval = 0usize; let mut val = (b[0] - b[m-1]) as f64; for i in 1..m { let expval = m as f64 / i as f64; let expval = sumval as f64 / i as f64 + expval; if val > expval { val = expval; } sumval += summary[i]; } println!("{:.09}", result+val); }