beecrowd | 1970

First Contact

By Leandro Zatesko, UFFS BR Brazil

Timelimit: 2

Whoever has already got a Super Nintendo remembers how the cartridges never used to work at the first contact with the console. Sometimes one was supposed to blow several times into the connectors of both the cartridges and the console so the connection could be successfully established. Thankfully, the technology has evolved, but, spit it out, you cannot say you do not miss that time, can you?

Fernando is a boy fascinated by studying old video games. He has found out that it is even possible to record music to Super Nintendo old cartridges. He has a collection of songs in his computer and he would like to record them to some cartridges. He knows that each cartridge has recording capacity of at most a limited number of minutes of music, and he knows the duration in minutes of each song. However, he is finding it difficult to decide which songs should be recorded to which cartridges in order to maximise the use of the cartridges.

Input

The first input line consists of two positive integers N e K (N ≤ 100, K ≤ 3), which represent respectively the number of songs in Fernando's computer and the number of cartridges he has got. The second input line consists of N positive integers, which represent the duration in minutes of each song. The last input line consists of K positive integers, which represent the maximum number of minutes of music that it is possible to record to each cartridge. No song has more than 50 minutes, and to no cartridge more than 50 minutes of music can be recorded.

Output

Print a line containing singly the maximum total number of minutes of music that it is possible to record to the cartridges.

Input Samples Output Samples

8 3
7 3 3 2 4 4 2 3
9 8 9

26

10 1
31 36 16 13 10 13 36 47 1 21
20

17

10 2
41 8 48 49 33 2 41 26 5 39
22 37

48