Konnexions Problem 1

3.3

3 votes
Easy
Problem

Your cousins are coming to visit you today. You're expecting n cousins and you have m chocolates. You want to distribute all the chocolates evenly between your cousins in such a way that each one receives the same number of whole chocolates. If there are not enough chocolates to give everyone the same amount, you must go to the market and buy some number of additional chocolates.

Given n and m, find and print the minimum number of additional chocolates you must buy so that everybody receives the same number of chocolates.

Input Format

A single line of two space-separated integers describing the respective values of n and m.

Constraints 1 <= n,m <= 10^9.

Output Format

Print a single integer denoting the number of additional chocolates you need to buy so that each of your cousin has the same number of whole chocolates.

Sample Input

3 2

Sample Output

1

Explanation

There are n=3 cousins coming to visit and you've 2 chocolates. For each person to have the same number of whole chocolates, you must buy 1 additional chocolate. Thus, we print 1 as our answer.

Time Limit: 3
Memory Limit: 256
Source Limit:
Editor Image

?