cho.sh
Notes
Loading...

Sausage Sharing

Time limit

1s

Memory limit

128 MB

Problem

Sunyoung has prepared N identical sausages for M food critics. She wants to cut the sausages so that every critic receives exactly the same total amount of sausage.

Find the minimum number of cuts required.

Input

The first line contains two integers N and M, the number of sausages and the number of critics.

  • 1 <= N, M <= 100

Output

Print the minimum number of cuts needed so that all critics can receive the same amount.