Bob hasn't been doing well in school lately, so his parents have decided to create an incentive to motivate him. Bob will be given some money depending on his results on the next tests. The tests are ordered and labelled from to and the test has already been assigned a value by Bob's parents where is a non-decreasing sequence. They have promised that for each test , they will award him with times the number of his marks among the earlier marks which he exceeded. In other words, if Bob's marks on the tests are , then Bob will earn
Bob knows that his mark on a given test is directly proportional to the amount of effort he puts into that test and that this amount of effort is always a non-negative integer. He also knows that he has a limited total amount of effort . Can you help Bob determine how much money he can make?
Constraints
for all
Subtask 1 [20%]
Subtask 2 [30%]
Subtask 3 [50%]
Input Specification
The first line contains two space-separated integers, and .
The next line contains space-separated integers, .
Output Specification
Output a single integer, the maximum amount of money Bob can earn.
Sample Input 1
3 2
1 2 3
Sample Output 1
6
Explanation for Sample 1
Bob should put effort into the first two tests and effort into the last test. That way, he earns .
Sample Input 2
5 0
100 100 100 100 100
Sample Output 2
0
Comments