E. Stick Divisions
time limit per test
2 seconds
memory limit per test
1024 megabytes
input
standard input
output
standard output

You have a stick of length $$$x$$$ and you want to divide it into $$$n$$$ sticks, with given lengths, whose total length is $$$x$$$.

On each move you can take any stick and divide it into two sticks. The cost of such an operation is the length of the original stick.

What is the minimum cost needed to create the sticks?

Input

The first input line has two integers $$$x$$$ ($$$1 \leq x \leq 10^9$$$) and $$$n$$$ ($$$1 \leq n \leq 2\cdot10^5$$$): the length of the stick and the number of sticks in the division.

The second line has $$$n$$$ integers $$$d_1,d_2,\ldots,d_n$$$ ($$$1 \leq d_i \leq x, \sum d_i = x$$$): the length of each stick in the division.

Output

Print one integer: the minimum cost of the division.

Example
Input
8 3
2 3 3
Output
13