Potassium Chlorate's total molar mass is 122.55 g/mol. The chemical formula is KClO3.
There are 3 Oxygens and Oxygen's molar mass is 16 g, so 16 g x 3 = 48 g O
This means with 40 g of Oxygen it isn't a full mole. Find what fraction of a mole you have.
40 g / 48 g = .83333 moles
Multiply this by the total molar mass of Potassium Chlorate (122.55 g/mol)
.83333 x 122.55 g = 102.125 g KClO3