Problem: Nastya baked pancakes and spread them on dishes. The dishes are in a row and numbered from left to right. She put pancakes on the dish with the index .
Seeing the dishes, Vlad decided to bring order to the stacks and move some pancakes. In one move, he can shift one pancake from any dish to the closest one, that is, select the dish () and do one of the following:
- if , put the pancake on a dish with the previous index, after this move and ;
- if , put the pancake on a dish with the following index, after this move and .
Vlad wants to make the array non-increasing, after moving as few pancakes as possible. Help him find the minimum number of moves needed for this.
The array is called non-increasing if for all from to .
Input Format: The first line of the input contains two numbers and () — the number of dishes and the number of pancakes, respectively.
The second line contains numbers (), the sum of all is equal to .
Output Format: Print a single number: the minimum number of moves required to make the array non-increasing.
Note: In the first example, you first need to move the pancake from the dish , after which . After that, you need to move the pancake from the dish to the dish and the array will become non-growing .