#C2024. Minimum Movements to Start

    ID: 45295 Type: Default 1000ms 256MiB

Minimum Movements to Start

Minimum Movements to Start

You are given k balls placed on a one-dimensional board of length w. Each ball is initially located at a given position on the board. To move a ball to the starting position (position 0), you need to make a number of movements equal to the ball's position. Your task is to compute the total number of movements required to bring all the balls to the start.

Mathematically, if the positions of the balls are given by \(a_1, a_2, \dots, a_k\), then the answer is:

[ \sum_{i=1}^{k} a_i ]

Note: The parameter w represents the size of the board and does not affect the answer.

inputFormat

The input is read from standard input and consists of two lines:

  • The first line contains two integers k and w, where k is the number of balls and w is the size of the board.
  • The second line contains k space-separated integers, representing the positions of the balls.

outputFormat

Output a single integer representing the total number of movements required to move all balls to the start position.

## sample
5 100
2 3 7 8 99
119