Codeforces Round 402 (Div. 2) |
---|

Finished |

Virtual contest is a way to take part in past contest, as close as possible to participation on time. It is supported only ICPC mode for virtual contests.
If you've seen these problems, a virtual contest is not for you - solve these problems in the archive.
If you just want to solve some problem from a contest, a virtual contest is not for you - solve this problem in the archive.
Never use someone else's code, read the tutorials or communicate with other person during a virtual contest.

constructive algorithms

greedy

sortings

*1200

No tag edit access

The problem statement has recently been changed. View the changes.

×
C. Dishonest Sellers

time limit per test

2 secondsmemory limit per test

256 megabytesinput

standard inputoutput

standard outputIgor found out discounts in a shop and decided to buy *n* items. Discounts at the store will last for a week and Igor knows about each item that its price now is *a*_{i}, and after a week of discounts its price will be *b*_{i}.

Not all of sellers are honest, so now some products could be more expensive than after a week of discounts.

Igor decided that buy at least *k* of items now, but wait with the rest of the week in order to save money as much as possible. Your task is to determine the minimum money that Igor can spend to buy all *n* items.

Input

In the first line there are two positive integer numbers *n* and *k* (1 ≤ *n* ≤ 2·10^{5}, 0 ≤ *k* ≤ *n*) — total number of items to buy and minimal number of items Igor wants to by right now.

The second line contains sequence of integers *a*_{1}, *a*_{2}, ..., *a*_{n} (1 ≤ *a*_{i} ≤ 10^{4}) — prices of items during discounts (i.e. right now).

The third line contains sequence of integers *b*_{1}, *b*_{2}, ..., *b*_{n} (1 ≤ *b*_{i} ≤ 10^{4}) — prices of items after discounts (i.e. after a week).

Output

Print the minimal amount of money Igor will spend to buy all *n* items. Remember, he should buy at least *k* items right now.

Examples

Input

3 1

5 4 6

3 1 5

Output

10

Input

5 3

3 4 7 10 3

4 5 5 12 5

Output

25

Note

In the first example Igor should buy item 3 paying 6. But items 1 and 2 he should buy after a week. He will pay 3 and 1 for them. So in total he will pay 6 + 3 + 1 = 10.

In the second example Igor should buy right now items 1, 2, 4 and 5, paying for them 3, 4, 10 and 3, respectively. Item 3 he should buy after a week of discounts, he will pay 5 for it. In total he will spend 3 + 4 + 10 + 3 + 5 = 25.

Codeforces (c) Copyright 2010-2023 Mike Mirzayanov

The only programming contests Web 2.0 platform

Server time: Oct/01/2023 08:18:13 (f1).

Desktop version, switch to mobile version.

Supported by

User lists

Name |
---|