P6536 [COCI 2013/2014 #1] KUŠAČ
Background
Dun Dun invites you to evenly split sausages.
Description
There are $n$ sausages, and they need to be evenly divided among $m$ tasters.
Each cut can split a sausage into two parts. You need to use as few cuts as possible to obtain sausages that meet the requirement. Find the minimum number of cuts needed.
Input Format
The input consists of one line with two positive integers $n$ and $m$.
Output Format
Output one line with the minimum number of cuts.
Explanation/Hint
#### Sample Explanation
#### Sample 1 Explanation
There are $2$ sausages and $6$ tasters. Cut each sausage into three equal parts, which takes $4$ cuts.
#### Sample 2 Explanation
There are $3$ sausages and $4$ tasters. Cut the sausages into pieces of size $\tfrac{3}{4}$. The first three people each get $\tfrac{3}{4}$, and the last person gets $3\times \tfrac{1}{4}$.
---
#### Constraints
For all test cases, it is guaranteed that $1\le n,m\le 100$.
---
#### Notes
**This problem is translated from [COCI2013-2014](https://hsin.hr/coci/archive/2013_2014/) [CONTEST #1](https://hsin.hr/coci/archive/2013_2014/contest1_tasks.pdf) _T2 KUŠAČ_.**
Translated by ChatGPT 5