#lang racket

(require racket/future)

(define (sum values)
(foldr + 0 values))

(define (best vals-1 vals-2 target)
(if (< (abs (- target (sum vals-1)))
(abs (- target (sum vals-2))))
vals-1
vals-2))

(define (closest values target)
(cond [(= 1 (length values))
values]
[(= 0 target)
'()]
[else
(let ([wout-first
(future (λ () (closest (rest values) target)))]
[with-first
(future (λ () (closest (rest values) (- target (first values)))))])
(best (touch wout-first) (cons (first values) (touch with-first)) target))]))