using System; using System.Linq; using System.Collections.Generic; public class Solution { public static void Main() { var vals = Console.ReadLine().Split(' ').Select(int.Parse).ToArray(); var n = vals[0]; var k = vals[1]; var result = 0; if(n != 0 || k == 0 || k > n) { if(k * 2 - 1 == n) { result = n - 1; } else { result = n - 2; } } Console.WriteLine(result); } }