Molarity = (numer of mole solute) / (volume of the solution)
number of mole solute = mass solute/molar mass solute
Molarity =( mass solute/molar mass solute)/ (volume of the solution)=
= ( mass solute/((molar mass solute)*(volume of the solution))
If m is a mass of the solute, M is a molar mass a solute, V is a volume of the solution (we can think as a volume of water added).
Molarity = m/(M*V)