Solution (source code)

= Solution

Equiprobability gives $H=\log_2m$.