#abc141d. [abc141_d]Powerful Discount Tickets
[abc141_d]Powerful Discount Tickets
Problem Statement
Takahashi is going to buy items one by one.
The price of the -th item he buys is yen (the currency of Japan).
He has discount tickets, and he can use any number of them when buying an item.
If tickets are used when buying an item priced yen, he can get the item for (rounded down to the nearest integer) yen.
What is the minimum amount of money required to buy all the items?
Constraints
- All values in input are integers.
Input
Input is given from Standard Input in the following format:
Output
Print the minimum amount of money required to buy all the items.
Sample Input 1
3 3
2 13 8
Sample Output 1
9
We can buy all the items for yen, as follows:
- Buy the -st item for yen without tickets.
- Buy the -nd item for yen with tickets.
- Buy the -rd item for yen with ticket.
Sample Input 2
4 4
1 9 3 5
Sample Output 2
6
Sample Input 3
1 100000
1000000000
Sample Output 3
0
We can buy the item priced yen for yen with tickets.
Sample Input 4
10 1
1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000
Sample Output 4
9500000000