using System; using System.Linq; class Program { static void Main(string[] args) { string[] AB = Console.ReadLine().Split(' '); long A = long.Parse(AB[0]); long B = long.Parse(AB[1]); long max = 2000000000; long min = 0; if (A < B) { max = A - 1; } else { min = A; } Console.WriteLine(max - min); } }