P23185 [AtCoder] [ABC014A] Distribution of Sweets by Mr. Kensho
入门
题目描述

Problem Description

Mr. Kensho, a kindergarten teacher, wants to distribute his $a$ sweets equally among $b$ children. He wants to distribute all the sweets he has, but he realized that it might not be possible to distribute them equally among all children depending on the combination of $a$ and $b$. Therefore, Mr. Kensho decided to buy the minimum number of additional sweets needed. For example, consider the scenario where he has 7 sweets to distribute among 3 children. As it stands, he cannot distribute them equally, so he buys 2 more sweets, making the total 9, which allows him to distribute 3 sweets to each of the 3 children.

Now, as a genius programmer, you, Takahashi, have decided to write a program to tell Mr. Kensho how many more sweets he needs to buy.

Input Format

The input is given from the standard input in the following format:

$ a $ $ b $

  • The first line contains an integer $a$ $(1 \leq a \leq 100)$, representing the number of sweets Mr. Kensho initially has.
  • The second line contains an integer $b$ $(1 \leq b \leq 100)$, representing the number of children.

Output Format

Output the number of sweets Mr. Kensho needs to buy in one line. Ensure a newline at the end of the output.

Sample Input and Output

Sample Input #1

7
3

Sample Output #1

2

Sample Input #2

5
5

Sample Output #2

0

Sample Input #3

1
100

Sample Output #3

99

Sample Input #4

25
12

Sample Output #4

11

Notes/Hints

Sample Explanation 1

This is the case explained in the problem statement. The remainder of 7 divided by 3 is 1, so buying 2 more sweets makes it 9, allowing him to distribute 3 sweets to each child.

Sample Explanation 2

No additional sweets are needed as 5 sweets can be distributed equally among 5 children.

Sample Explanation 3

Since there is only 1 sweet, 99 more sweets need to be bought to distribute 1 sweet to each of the 100 children.

Sample Explanation 4

Buying 11 more sweets makes the total 36, which can be distributed as 3 sweets to each of the 12 children.

输入格式

见题面 Input 部分

输出格式

见题面 Output 部分

样例输入
7 3
样例输出
2