#K79812. Unmet Water Requirement

    ID: 35392 Type: Default 1000ms 256MiB

Unmet Water Requirement

Unmet Water Requirement

You are given n plants, and each plant can be given at most d units of water per day. Each plant i requires a certain amount of water given by an integer in the list water_requirements.

If a plant requires more than d units, the unmet water amount for that plant is defined as \( water\_requirements_i - d \). Your task is to calculate the total unmet water requirement for all the plants. In mathematical terms, you need to compute:

\( \sum_{i=1}^{n} \max(0, water\_requirements_i - d) \)

The input is given from stdin and the result should be printed to stdout.

inputFormat

The input consists of two lines:

  • The first line contains two integers n and d separated by a space, where n is the number of plants and d is the maximum water provided to each plant per day.
  • The second line contains n space-separated integers representing the water requirement of each plant.

outputFormat

Output a single integer that represents the total unmet water requirement, printed to stdout.

## sample
3 4
3 6 2
2

</p>