fn main() { proconio::input! { l: u64, n: u64, mut w: [u64; n], } w.sort_unstable(); let mut sum = 0; let mut ans = 0; for w in w { if w + sum <= l { sum += w; ans += 1; } } println!("{ans}"); } fn proc(a: u64, b: u64) -> u64 { b.div_ceil(a) } #[cfg(test)] mod test { use super::*; #[test] fn test() { assert_eq!(proc(2, 5), 3); } }