Problem H
Flatbökuveisla
Languages
en
is
Ómar recently ordered pizzas. After a short wait the doorbell rings. He opens the front door and before his eyes lie boxes marked with Flýtibaka. He grabs the boxes and places them on the dining table, then calls out loudly and clearly that the food has arrived. All the residents of the household come to the dining table in the blink of an eye.
When the pizzaboxes are open, the number of pizza slices can be counted, and they are $n$ in total. The number of people living in Ómar’s household are $m$. The residents are all very hungry and eat as much as they possibly can, but the rules of the household state that all residents must get an equal number of slices. The rule has a flaw, since there may be some food left over which nobody eats. How many slices will be left over?
Input
Input consists of two lines. The former line consists of a single integer $n$, the number of slices. The latter line consists of a single integer $m$, the number of residents in Ómar’s household.
Output
Print one integer, the number of slices left over.
Scoring
Group |
Points |
Constraints |
1 |
100 |
$1 \leq n, m \leq 10^6$ |
Sample Input 1 | Sample Output 1 |
---|---|
8 3 |
2 |
Sample Input 2 | Sample Output 2 |
---|---|
20 7 |
6 |
Sample Input 3 | Sample Output 3 |
---|---|
999999 10 |
9 |