<?php /*atcoder.php*/

$at = new Atcoder();
$at->main();
unset($at);

class Atcoder{
	private function arrayIn(){
		$buf = explode(" ", fgets(STDIN));
		return $this->killNewLine($buf);
	}
	private function killNewLine($buf = null){
		$buf = str_replace("\r\n", "", $buf);
		$buf = str_replace("\n", "", $buf);
		$buf = str_replace("\r", "", $buf);
		return $buf;
	}

	public function main(){
		$s = $this->arrayIn();
	
		$n = $s[0];
		$x = $s[1];

		$c = $this->arrayIn();

		$ans = array();
		$buf = 0;

		for($i = 0; $i < 200000; $i++){
			shuffle($c);
			foreach($c as $v){
				if(0 <= ($x - $v)){
					$x -= $v;
					$buf++;
				}else{
					break;
				}
			}
			unset($v);
			$ans[] = $buf;
			$buf = 0;
			$x = $s[1];
		}

		rsort($ans);

		echo $ans[0] . "\n";

	}
}
?>