You know a commodity's price on each of n consecutive days. You may complete any number of trades, where a trade is buying one unit and later selling that same unit (you may hold at most one unit at a time, and must sell before buying again). Every completed sale costs a fixed transaction fee fee (paid out of the sale proceeds). Maximize total profit; if no trade is worthwhile, the answer is 0 (you are never forced to trade).
Input format
Line 1: two integers n fee.
Line 2: n space-separated positive integers, the prices on each day (empty if n = 0).
Output format
A single integer: the maximum total profit achievable.
Constraints
- 0 ≤ n ≤ 100000
- 0 ≤ fee ≤ 1000
- 1 ≤ each price ≤ 10000