#![allow(unused_imports)] use std::cmp::*; use std::collections::*; use std::io::Write; use std::ops::Bound::*; #[allow(unused_macros)] macro_rules! debug { ($($e:expr),*) => { #[cfg(debug_assertions)] $({ let (e, mut err) = (stringify!($e), std::io::stderr()); writeln!(err, "{} = {:?}", e, $e).unwrap() })* }; } fn main() { let v = read_vec::(); let (n, m) = (v[0], v[1] as usize); let b = read_vec::().iter().map(|&x| x).collect::>(); let mut x_min = std::f64::MAX; let mut accum = 0.0; let mut sum = 0; for i in (0..m).rev() { accum += 1.0; sum += n - b[i]; x_min = f64::min(x_min, sum as f64 / accum + m as f64 / accum); } // debug!(x_min); let ans = f64::min(n as f64 - 1.0, b[0] as f64 - 1.0 + x_min); println!("{}", ans); } fn read() -> T { let mut s = String::new(); std::io::stdin().read_line(&mut s).ok(); s.trim().parse().ok().unwrap() } fn read_vec() -> Vec { read::() .split_whitespace() .map(|e| e.parse().ok().unwrap()) .collect() }