(define (System.out.println x) (begin (display x) (newline) ) ) (let ( (Capacity (read)) (N (read)) ) (let loop( (ls '()) (foo (read)) ) (if (eof-object? foo) (let loop2( (RemainingCapacity Capacity) (UsedBlocks 0) (bar (sort ls <)) ) (if (< (- RemainingCapacity (car bar)) 0) (System.out.println UsedBlocks) (loop2 (- RemainingCapacity (car bar)) (+ UsedBlocks 1) (cdr bar)) ) ) (loop (cons foo ls) (read)) ) ) )