#include #include using namespace std; int main() { cin.tie(nullptr); ios::sync_with_stdio(false); uint32_t N, M; cin >> N >> M; uint64_t ans = 0; for (; N != 0 && M != 1; --N, M = (M + 1) >> 1) ans += M; cout << ans + N << '\n'; return 0; }