#include long int func(long int, long int); int main(void) { long int n,m; scanf("%ld", &n); scanf("%ld", &m); printf("%d\n", func(n, m)); return 0; } long int func(long int n, long int m) { if (n == 1) return m; else if (n%2 == 0) return (n / 2); else return func(((n + 1) / 2), (m + 1)); }