Problems
Absolute difference
Absolute difference
Amin can decrease the number $x$ by $k$ units in one operation. If the result turns out to be negative, he will write down the absolute value of the result in $x$. In other words, the operation takes the form: $x = |x - k|$.
Hussein named the number $x$ to Amin as the initial one. Determine the smallest value that can be obtained from it by repeating the above operation any number of times.
This is a very difficult task for Amin. Calculate the answer for him.
\InputFile
Two integers $x~(0 \le x \le 10^{18})$ and $k~(1 \le k \le 10^{18})$.
\OutputFile
Output the smallest value that can be obtained from $x$.
\Examples
In the first test, $x = 11$. After performing one operation, we get $x = |11 - 4| = 7$.
After two operations, $x = |7 - 4| = 3$.
After three operations, $x = |3 - 4| = 1$, which is the smallest value that $x$ can take.
In the second test, $x = 2$. It is also the smallest value that $x$ can take.
Input example #1
11 4
Output example #1
1
Input example #2
2 5
Output example #2
2
Input example #3
1000000000000000000 1
Output example #3
0