using System; namespace yukicoder { class Program { static void Main(string[] args) { var L = Console.ReadLine(); var z = L.Split(" "); int[] ints = new int[z.Length]; //文字分割 for (int i = 0; i < z.Length; i++) { ints[i] = int.Parse(z[i]); } if (ints[0] / 2 <= ints[1]) { Console.WriteLine("0"); } else if ((ints[0] % ints[1] == 0)) { int temp = ints[0] / (ints[1] * 2); int ans = temp * ints[1] - ints[1]; Console.WriteLine(ans); } else { int temp = ints[0] / (ints[1] * 2); int ans = temp * ints[1]; Console.WriteLine(ans); } } } }