$2^m$ requirement is for the pre-image attack. You have to hash approximately  $2^m$ messages to find the message that has the same value you were looking for if the hash function has [pre-image resistance][1]. 

In a collision attack, you are looking for two messages that have the same hash value.

If you look at Wikipedia Birthday Paradox at section [Cast as a collision problem][2], it is also generalized for the arbitrary number of days not just for 365 days. The approximation is given by 

$$n \approx \sqrt{2^m}$$


  [1]: https://crypto.stackexchange.com/a/63340/18298
  [2]: https://en.wikipedia.org/wiki/Birthday_problem#Cast_as_a_collision_problem