use std::io::Read; fn main() { let mut s = String::new(); std::io::stdin().read_to_string(&mut s).ok(); let i: Vec = s.split_whitespace().flat_map(str::parse).collect(); let mut c = 0; let mut k = i[1]; let mut a = i[2..].to_vec(); a.sort(); for &a in a.iter() { if a < k { c += 1; k -= a; } else { break; } } println!("{} {}", c, k) }