题目描述
Problem Description
Takahashi is trying to distribute $ N $ balls to $ K $ people.
Determine the maximum possible difference in the number of balls between the person with the most balls and the person with the least balls, under the condition that each person receives at least one ball.
Input Format
The input is given from the standard input in the following format:
$ N $ $ K $
Output Format
Output the maximum possible difference in the number of balls.
Sample Input and Output
Sample Input #1
3 2
Sample Output #1
1
Sample Input #2
3 1
Sample Output #2
0
Sample Input #3
8 5
Sample Output #3
3
Notes/Hints
Constraints
- $1 \leq K \leq N \leq 100$
- All inputs are integers.
Sample Explanation 1
The only way to distribute 3 balls to 2 people such that each person receives at least one ball is to give one person 1 ball and the other person 2 balls. Therefore, the maximum difference in the number of balls is 1.
Sample Explanation 2
There is only one person to distribute 3 balls to, so the difference in the number of balls is 0.
Sample Explanation 3
For example, if 5 people receive 1, 4, 1, 1, and 1 ball respectively, the difference between the person with the most balls and the person with the least balls is 3, which is the maximum.
输入格式
见题面 Input 部分
输出格式
见题面 Output 部分