Trivial nitpick: since this is binary search, the base for the logarithm is 2, not e. So it would be 2^M.
Big fleas have little fleas upon their backs to bite 'em \ And little fleas have lesser fleas, and so, ad infinitum.
Logs get to not care, but when we exponentiate it matters.