P25355 [AtCoder] Bus Tour
提高
题目描述

Problem Description

You are planning a bus tour.

Participants in the bus tour always apply in groups of $ N $ people. Each bus, excluding the driver, has a capacity of exactly $ M $ people.
This bus tour is conducted with the minimum number of buses required to accommodate all participants.
People belonging to the same group do not necessarily need to board the same bus.

There is no upper limit on the number of groups participating in the bus tour, so the number of groups participating is unknown until applications close.
Therefore, depending on the number of participants, there may be empty seats on the buses.
What is the maximum number of empty seats that could occur?

Input Format

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

$ N $ $ M $

Output Format

Output the maximum number of empty seats in the bus tour.

Sample Input and Output

Sample Input #1

5 4

Sample Output #1

3

Sample Input #2

1000000 10

Sample Output #2

0

Sample Input #3

500000000 1000000000

Sample Output #3

500000000

Notes/Hints

Constraints

  • $1 \leq N \leq 10^9$
  • $1 \leq M \leq 10^9$
  • $ N $ and $ M $ are integers.

Sample Explanation 1

If there was only one group applying, for 5 participants and a bus capacity of 4 people, 2 buses would be needed for the bus tour, resulting in 3 empty seats.

Sample Explanation 2

Regardless of the number of groups applying, there could always be buses that are fully occupied.

输入格式

见题面 Input 部分

输出格式

见题面 Output 部分

样例输入
5 4
样例输出
3