This is a proportion question. You can figure out the answer yourself by drawing a square that's made up of four little squares.
You can work this problem two different directions, up-down or right-left, based on whatever looks easier to you.
To get M, you need to determine
DOWN-UP: what do you have to do to an 8 to make it into a 5, and then do the same to 24.
LEFT-RIGHT: what do you have to do to an 8 to make it into a 24, then do the same to 5.
I think the second question looks easier - how many 8s are in 24?
What is that many 5's be?
That will get you the answer you are looking for.
M = 15
Now, depending on the class, there are different ways the teacher might want you to get TO the answer. They are ALL equivalent, as long as they all get the same number.
In this case, you have m/24 on one side of the equals sign. That means that multiplying the other side by 24 will cancel the /24 on the right side get you the correct answer for M on the left side.
I've flipped left and right here just to put the M on the left.
m = 24*5/8 = 120/8 = 15