Repairment is an essential part of our collective mission to do things better and protect the environment. Raw materials used in electronics are becoming increasingly scarce, and at the same time waste from obsolete electronics is growing into a bigger and bigger problem every day. It is essential that we make an effort to reuse what we already have and thereby increase the lifetime of every product.
All you need is epoxy glue (or super glue if you do not have epoxy glue).
Optionally epoxy can be applied to further strengthen the glue.
If the earpad fits too tight on the speaker unit, it might be because of too much glue making it thicker. To fix this you will need to peel the sides off again and carefully remove the glue. After that make sure to apply a thinner layer of glue.