#C9768. Maximum Sum After Replacement

    ID: 53897 Type: Default 1000ms 256MiB

Maximum Sum After Replacement

Maximum Sum After Replacement

In this problem, you are given an array of integers and two numbers: (n), the length of the array, and (m), a replacement value. You are allowed to replace every element in the array with (m). Your task is to determine the maximum possible sum of the array after this operation. In other words, after replacing every element with (m), the sum becomes (n \times m).

inputFormat

The input is read from standard input (stdin). The first line contains two space-separated integers (n) and (m), where (n) denotes the number of elements in the array, and (m) is the replacement value. The second line contains (n) space-separated integers representing the elements of the array.

outputFormat

The output is written to standard output (stdout) and consists of a single integer, the maximum possible sum of the array after replacing all its elements with (m), which is calculated as (n \times m).## sample

5 10
1 2 3 4 5
50