Call this with the number of integers the sum, the desired sum, and the list of integers to pick from. Returns a list of arrays whose sum is the desired sum:
sub _{@_>2&&$_[0]>0?(($_[2]==$_[1]&&$_[0]==1?[$_[2]]:()),&_($_[0],$_[1
+],@_[3..$#_]),map[$_[2],@$_],&_($_[0]-1,$_[1]-$_[2],@_[3..$#_])):()}