use std::io;
use std::cmp;

fn read_line() -> String {
    let mut line = String::new();

    io::stdin().read_line(&mut line)
        .expect("Failed to read line");
    return line;
}
fn to_i(s: &str) -> i32 {
    return s.trim().parse()
        .expect("Please type a number!");
}


fn check(index :u32, xx: &Vec<i32>, val: i32) -> i32 {
    let limit = (xx.len()) as u32;


    if index==limit {
        if val == 0 {
            return 0;
        } else {
            return -1;
        }
        
    }
    let x = xx[index as usize];
    if val < x {
        return check(index + 1, xx, val);
    }else {
        let r1 = check(index + 1, xx, val);
        let r2 = 1 + check(index + 1, xx, val-x);
        return cmp::max(r1, r2);
    }
    

}
fn main() {

    let l1 = read_line();
    
    let nx: Vec<&str> = l1.split(' ').collect();

    let _n: i32 = to_i(nx[0]);
    let x: i32 = to_i(nx[1]);

    let l2 = read_line();
    

    let items: Vec<&str> = l2.split(' ').collect();
    //println!("items:{:?}", items);

    let mut nums: Vec<i32> = Vec::new();

    for item in items {
        nums.push(to_i(item));
    }
    nums.sort();
    nums.reverse();



    let mut count = check(0, &nums, x);
    if count <0 {
        count = 0;
    }


    print!("{}", count);


}   