IAPCR2A - Dividing Apples

Frodo has N apples. He wants to divide the apples among his M friends so that each of them gets equal number of apples. As Frodo is very generous he wants to give away as many apples as he can. After the distribution Frodo will keep the rest of the apples.

For example, Frodo has 10 apples and 3 friends. He can give each of them 3 apples but cannot give 4 as he would need 3*4=12 apples then. So, he will give away 3*3=9 apples and 1 will be left.

Now, given N and M find out how many apples will be left to Frodo after distributing to M friends.

Input

Only two integers in a line N M. N (1≤N≤1000), denotes the number of apples and M (0≤M≤100) denotes the number of friends.

Output

Print one integer, the number of apples that will be left to Frodo.

Example

Input:
10 3

Output:
1

Added by:imranziad
Date:2016-06-03
Time limit:0.5s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All except: ASM64 GOSU JS-MONKEY
Resource:Intra AIUB Programming Contest R2

© Spoj.com. All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.