Space Invaders
Peter wrote his version of the popular game "Space Invaders". The game is as follows. On the ground attack ships of Space Invaders. They lined up in rows at the top of the screen. The player controls a laser gun, which is located at the bottom of the screen in one of the columns. For one action a player can move the gun left or right, or make a shot straight up. If a player makes a shot, it destroys the alien ship coming in that column, in which the gun.
Unlike the original game, Petya embodiment of alien ships are in place and can not shoot, so the player can not lose. Help the Pete destroy all alien ships in a minimum number of operations.
Input
The first line contains the number n and p - number of columns and column number, which is initially a gun (1 ≤ n ≤ 100, 1 ≤ p ≤ n). The second line contains n numbers a_1, a_2, ..., a_n, where a_i - the number of aliens in the i^th column (1 ≤ a_i ≤ 100).
Output
In the output file output a single number - the minimum number of operations required to destroy all the aliens.