use std::io::stdin; pub fn main() { let line = || { let mut s = String::new(); let _ = stdin().read_line(&mut s); s }; let l: usize = line().trim().parse().unwrap(); line(); let mut ws: Vec = line().split_whitespace().flat_map(|x| x.parse()).collect(); ws.sort(); let mut sum = 0; let mut ct = 0; for w in ws { match sum + w { x if x == l => { ct += 1; break; } x if x > l => { break; } x => { sum = x; ct += 1; } } } println!("{}", ct); }