favorite We need a little bit of your help to keep things running, click on this banner to learn more
Problems

# CD

You have a long drive by car ahead. You have a tape recorder, but unfortunately your best music is on CDs. You need to have it on tapes so the problem to solve is: you have a tape N minutes long. How to choose tracks from CD to get most out of tape space and have as short unused space as possible.

Assumptions:

• number of tracks on the CD. does not exceed 100
• no track is longer than N minutes
• length of each track is expressed as an integer number
• N is also integer (0 ≤ N ≤ 200).

Program should find the set of tracks which fills the tape best and print it in the same sequence as the tracks are stored on the CD.

Input

Any number of lines. Each one contains value N, (after space) number of tracks and durations of the tracks. For example from first line in sample data: N=5, number of track s=3, first track lasts for 1 minute, second one 3 minutes, next one 4 minutes.

Output

String "sum:" and sum of duration times.

Time limit 1 second
Memory limit 122.81 MiB
Input example #1
5 3 1 3 4
10 4 9 8 4 2
20 4 10 5 7 4
90 8 10 23 1 2 3 4 5 7
45 8 4 10 44 43 12 9 8 2

Output example #1
sum:5
sum:10
sum:19
sum:55
sum:45