#K12441. Minimum Cards Removal for Even Distribution

    ID: 23691 Type: Default 1000ms 256MiB

Minimum Cards Removal for Even Distribution

Minimum Cards Removal for Even Distribution

In a deck of cards, you are given two integers: n, which represents the total number of cards, and k, which represents the number of players. Your task is to determine the minimum number of cards to remove so that the remaining cards can be evenly distributed among the players.

The solution is based on the formula: $$n \mod k$$, where the result gives the number of cards that remain when n is divided by k.

inputFormat

The input consists of a single line containing two space-separated integers n and k.

outputFormat

Output a single integer representing the minimum number of cards that need to be removed so that the remaining cards can be evenly distributed among the players.## sample

52 4
0