my $input = <STDIN>;
chomp $input;
my ($N, $X) = split / /, $input;
my $input = <STDIN>;
chomp $input;
my @x = split / /, $input;
@x = sort {$a <=> $b} @x;
for ($i=0; $i<$N; $i++) {
  $X -= $x[$i];
  if ($X<0) {
    last;
  }
}
if ($X>0) {
  print "($i-1)\n";
} else {
  print "$i\n";
}