using System.Collections.Generic; using System.Linq; using System; public class Hello { static void Main() { string[] line = Console.ReadLine().Trim().Split(' '); var n = int.Parse(line[0]); var m = long.Parse(line[1]); getAns(n, m); } static void getAns(int n, long m) { var ans = new List(); ans.Add(m); while (m > 1) { m = m % 2 == 0 ? m / 2 : (m + 1) / 2; ans.Add(m); } if (ans.Count > n) { var ans2 = ans.OrderBy(x => x).Take(n).Sum(); Console.WriteLine(ans2); return; } var res = ans.Sum(); res += n - ans.Count - 1; Console.WriteLine(ans); } }