#abc358d. D - Souvenirs

D - Souvenirs

Score : 350350 points

问题陈述

AtCoder Land的一家纪念品商店出售NN个盒子。

这些盒子编号为11NN,第ii个盒子的价格为AiA_i日元,并且包含AiA_i块糖果。

高桥想要从NN个盒子中购买MM个,并将每个盒子分别送给名为1,2,,M1, 2, \ldots, MMM个人。

在这里,他想要购买能够满足以下条件的盒子:

  • 对于每个i=1,2,,Mi = 1, 2, \ldots, M,第ii个人将获得一个至少包含BiB_i块糖果的盒子。

请注意,不允许将多个盒子送给一个人,或者将同一个盒子送给多个人。

确定是否可能购买MM个盒子以满足条件,如果可能,请找出高桥需要支付的最低总金额。

以上为大语言模型 kimi 翻译,仅供参考。

Problem Statement

A souvenir shop at AtCoder Land sells NN boxes.

The boxes are numbered 11 to NN, and box ii has a price of AiA_i yen and contains AiA_i pieces of candy.

Takahashi wants to buy MM out of the NN boxes and give one box each to MM people named 1,2,,M1, 2, \ldots, M.

Here, he wants to buy boxes that can satisfy the following condition:

  • For each i=1,2,,Mi = 1, 2, \ldots, M, person ii is given a box containing at least BiB_i pieces of candy.

Note that it is not allowed to give more than one box to a single person or to give the same box to multiple people.

Determine whether it is possible to buy MM boxes that can satisfy the condition, and if it is possible, find the minimum total amount of money Takahashi needs to pay.

Constraints

  • 1MN2×1051 \leq M \leq N \leq 2 \times 10^5
  • 1Ai,Bi1091 \leq A_i, B_i \leq 10^9
  • All input values are integers.

Input

The input is given from Standard Input in the following format:

NN MM

A1A_1 A2A_2 \ldots ANA_N

B1B_1 B2B_2 \ldots BMB_M

Output

If it is possible to buy MM boxes that can satisfy the condition, print the minimum total amount of money Takahashi needs to pay. Otherwise, print 1-1.

Sample Input 1

4 2
3 4 5 4
1 4

Sample Output 1

7

Takahashi can buy boxes 11 and 44, and give box 11 to person 11 and box 44 to person 22 to satisfy the condition.

In this case, he needs to pay 77 yen in total, and it is impossible to satisfy the condition by paying less than 77 yen, so print 77.

Sample Input 2

3 3
1 1 1
1000000000 1000000000 1000000000

Sample Output 2

-1

Sample Input 3

7 3
2 6 8 9 5 1 11
3 5 7

Sample Output 3

19
}