fn main() { let n: u32 = read(); let _k: u32 = read(); let mut max: i32 = std::i32::MIN; let mut min: i32 = std::i32::MAX; for _i in 0..n { let temp: i32 = read(); //最大最小の更新 if max < temp { max = temp; } if min > temp { min = temp; } } println!("{}", max - min); } 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 { let mut s = String::new(); std::io::stdin().read_line(&mut s).ok(); s.trim().split_whitespace() .map(|e| e.parse().ok().unwrap()).collect() }