DMPG '18 B2 - Mimi and Modulus
View as PDFThe modulo operator is a very commonly used operation in computer science. The result of taking  modulo 
 is equal to the remainder of 
 when divided by 
.
For her ICS homework, Mimi was asked to find the greatest result of  mod 
 for all integers 
 in the range 
. Can you help Mimi do her homework?
Constraints
Subtask 1 [40%]
Subtask 2 [60%]
Input Specification
The first and only line of input will contain two space separated integers,  and 
.
Output Specification
The greatest result of  mod 
 for all integers 
 in the range 
.
Sample Input
5 3
Sample Output
2
Comments