use std::io::*; fn main() { let mut s = String::new(); std::io::stdin().read_to_string(&mut s).ok(); let mut itr = s.trim().split_whitespace(); let n: usize = itr.next().unwrap().parse().unwrap(); let mut m: usize = itr.next().unwrap().parse().unwrap(); let mut c: Vec = itr.map(|e| e.parse().unwrap()).collect(); c.sort(); let mut ans = 0; for i in 0..n { if m >= c[i] { m -= c[i]; ans += 1; } else { break; } } println!("{}", ans); }