S&M refers to sadism and masochism.
S&M is the commonly used term that refers to sadism and masochism. Sadism is sexual or emotional gratification from inflicting pain on another person or persons. A person who enjoys inflicting pain on others is called a sadist. Masochism is sexual or emotional gratification from feeling pain or suffering and the people who find it gratifying are called masochists.
While pain is often a part of role playing or a dominant/submissive relationship, there are sadists and masochists who are involved in causing and receiving pain who are not involved in either D&S or the dungeon/BDSM scene. S&M includes practices like cock and ball torture, the use of clips and clamps to cause pain to the nipples, tongue, genitals and other body parts, spanking, tying tightly enough to cause pain, whipping and many other forms of physically painful punishment.