QOJ.ac

QOJ

Time Limit: 2 s Memory Limit: 128 MB Total points: 10

#6586. Light Bulbs

الإحصائيات

Finishing jobs at Byteasar's new home are ending shortly. All that remains is to install new light bulbs in each of the $n$ rooms. The minimum bulb power rating has been determined for each of the rooms, to provide sufficient illumination.

Byteasar bought $n$ light bulbs, but now he noticed that they do not meet fully his expectations. It may not be possible to provide all rooms with an adequate illumination, and it is also possible that maybe some bulbs unnecessarily have too high power rating. Byteasar then decided to go to the store and replace some of the bulbs, so to be able to sufficiently illuminate all the rooms, and at the same time minimize the total power of the light bulbs. The shop has light bulbs available in all power ratings expressed by a positive number. Byteasar's backpack capacity allows him to to take no more than $k$ bulbs to be replaced, which is therefore the maximum number of light bulbs that he is ready to replace.

Help Byteasar to choose which bulbs should be replaced, so that all the rooms are adequately lit, and at the same time to minimize the total power of light bulbs.

Input Format

The first line of the input contains two integers $n$ and $k$ ($1\leq k \leq n \leq 500\,000 $), indicating the number of rooms (this is also the number of light bulbs) and the number of light bulbs that can be fitted in Byteasar's backpack. The rooms are numbered from $1$ to $n$. The second line of the input contains $n$ integers $p_1,p_2, \ldots,p_n$ ($1\leq p_i \leq 10^9$) denoting power ratings of the light bulbs which currently are at Byteasar's disposal. The third line of input contains $n$ integers $w_1,w_2,\ldots,w_n$ ($1\leq w_i \leq 10^9$) denoting the illumination requirements concerning the subsequent rooms: the room $i$ should be fitted with a bulb with bearing a minimal rating of $w_i$.

Output Format

In case it is not possible to replace at most $k$ bulbs in order to have all the rooms sufficiently illuminated, your program should output NIE (Polish for no). Otherwise, an integer should be written indicating the minimum total power of all light bulbs used to illuminate the home after exchanging at most $k$ bulbs.

Examples

Input

6 2
12 1 7 5 2 10
1 4 11 4 7 5

Output

33

Explanation

It is enough to replace the bulb with a power rating of $2$ with a bulb bearing a power rating of $4$, and the bulb with a power rating of $10$ with one rated $4$. Then almost all the rooms will have a light bulb installed of exactly such power rating as being a minimum requirement. The exception would be a room that would have been illuminated adequately with the bulb with the power rating of $11$, which will be illuminated by a bulb rated $12$.