401521: GYM100488 H Tony Hawk's Pro Skater

Memory Limit:256 MB Time Limit:2 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

H. Tony Hawk's Pro Skatertime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard output

Alex loves the game Tony Hawk's Pro Skater very much. Some tasks in this game oblige the player to perform tricks by pressing certain combinations of buttons and to earn points for that: the more — the better.

Alex has learned how to perform n types of tricks. But to make the game more interesting, its authors provided the following: the reward for every trick decreases while player keeps performing it (but cannot become less than 1). Thus, if player performs the i-th trick for the first time, he earns ai points, for the second time — points and so on: k-th performance costs points. Performance of the trick of some type doesn't affect the costs of tricks of the other types.

The time in the game is limited so Alex is able to perform only m tricks. What is the maximal number of points he can gain?

Input

The first line contains two integers n and m (1 ≤ n ≤ 105, 0 ≤ m ≤ 109) — the number of types of tricks Alex can perform and the number of tricks he has time to perform.

The next line contains n integers a1, ..., an (1 ≤ ai ≤ 109) — the initial costs of the tricks.

The next line contains n integers b1, ..., bn (1 ≤ bi ≤ 109) — the number of points by which the cost of the corresponding trick reduces at each its performance.

Output

Output a single integer — the maximal number of points which can be gained by performing m tricks.

ExamplesInput
3 6
9 7 17
1 2 3
Output
67
Input
3 7
9 7 17
2 1 4
Output
68

加入题单

算法标签: