Solution: If the list of items is empty, then the best that can be done is a sum of 0. If the list of items is non-empty, then if the first item is larger than the goal, it cannot be included. Otherwise, solve the problem recursively under two disjoint assumtions: that the first item is included or it is not.
pick(Goal, []) => [0, []]; // empty list can only meet goal 0
pick(Goal, [Item | Items]) =>
Item > Goal ? pick(Goal, Items) // Item too large to use
: [Sum1, Items1] = pick(Goal-Item, Items), // Try with Item
[Sum2, Items2] = pick(Goal, Items), // Try without Item
Sum1 + Item > Sum2 ? // Which is closer?
[Sum1+Item, [Item | Items1]] // Using item
: [Sum2, Items2]; // Not using item