use utf8; use strict; use warnings; use List::Util qw/sum/; my ($n, $w) = split / /, <>; my @a = split / /, <>; my $ans = 0; for (my $bit = 1; $bit < (1<<$n); $bit++) { my @prices = map $a[$_], grep {$bit& (1<<$_)} 0..$n-1; my $sum1 = sum @prices; $ans++ if ($sum1 == $w); for (my $i = 0; $i < @prices; $i++) { my $sum2 = $sum1 - $prices[$i] / 2; $ans++ if ($sum2 == $w); } } print "$ans\n";