using System; using static System.Console; using System.Linq; using System.Collections.Generic; class Program { static int NN => int.Parse(ReadLine()); static int[] NList => ReadLine().Split().Select(int.Parse).ToArray(); public static void Main() { Solve(); } static void Solve() { var c = NList; var (n, m) = (c[0], c[1]); var rest = n; var ans = 0L; var cur = m; while (cur > 1) { --rest; ans += cur; cur = (cur + 1) / 2; } WriteLine(ans + rest); } }