#K84522. Minimum Additional Sessions

    ID: 36438 Type: Default 1000ms 256MiB

Minimum Additional Sessions

Minimum Additional Sessions

You are given two integers \(n\) and \(m\) where \(n\) represents the number of topics and \(m\) represents the current number of sessions available. The goal is to determine the minimum number of additional sessions needed so that the total number of sessions becomes a multiple of \(n\), thereby allowing the topics to be distributed as evenly as possible among the sessions.

In mathematical form, you are required to compute:

$$\text{additional} = n \times \left\lceil \frac{m}{n} \right\rceil - m$$

If \(m\) is already a multiple of \(n\), then the answer is 0.

Examples:

  • For \(n = 3\) and \(m = 7\): The answer is 2 because the next multiple of 3 after 7 is 9, and \(9 - 7 = 2\).
  • For \(n = 5\) and \(m = 20\): The answer is 0 since 20 is already a multiple of 5.
  • For \(n = 4\) and \(m = 3\): The answer is 1 because the next multiple of 4 after 3 is 4, and \(4 - 3 = 1\).
  • For \(n = 10\) and \(m = 10\): The answer is 0.

inputFormat

The input is read from stdin and consists of a single line containing two space-separated integers \(n\) and \(m\).

\(n\): The number of topics.

\(m\): The current number of sessions available.

outputFormat

Output a single integer which represents the minimum number of additional sessions needed so that \(m\) becomes a multiple of \(n\) (i.e. \(n \times \lceil m/n \rceil - m\)). The result is printed to stdout.

## sample
3 7
2