Elasticity describes how quickly the molecules return to their original positions. Molecules that return to their original shape quickly are ready to move again more quickly, thus can vibrate at higher speeds. Sound can travel faster through mediums that vibrate faster. Thus, sound travels faster through elastic solids like nickel or iron than through solids like lead, which is less elastic. The density of a medium also affects the speed of sound.
Density describes the mass of a substance per volume.
A substance that is denser per volume has more mass per volume. Usually, larger molecules have more mass. If a material is denser because its molecules are larger, it will transmit sound slower. Sound waves are made up of kinetic energy. It takes more energy to make large molecules vibrate than it does to make smaller molecules vibrate.