What does “2 HD of creatures” for the spell Banishment mean?

The spell Banishment says it affects:

As many as 2 Hit Dice of creatures per caster level can be banished.

I’m fairly new to Pathfinder and still haven’t quite figured out what a spell means by “# HD of creatures”.

How do you figure out what a creature’s number of HD are?

Color Spray and Sleep have similar restrictions to their effects.