Absolute difference#11671

Absolute difference

1 second
128 megabytes
Easy

Amin can decrease the number by units in one operation. If the result turns out to be negative, he will write down the absolute value of the result in . In other words, the operation takes the form: x = |x - k|.

Hussein named the number 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.

Input

Two integers x~(0 \le x \le 10^{18}) and k~(1 \le k \le 10^{18}).

Output

Output the smallest value that can be obtained from .

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 can take.

In the second test, x = 2. It is also the smallest value that can take.

Example 1

Loading
Loading

Example 2

Loading
Loading

Example 3

Loading
Loading