Proteins must contain Nitrogen, Carbon, Hydrogen and Oxygen. However, they can also contain Sulfur/Phosphorus.
Rather than just remembering it like that, it's important to know why.
Whether a protein contains Sulfur/Phosphorus is ultimately dependent on what sort of amino acids are present in the protein's primary structure.
Due to the carboxyl (-COOH) and amine (NH
2) groups, which comprise a part of every amino acid, you definitely have to have nitrogen, carbon, hydrogen and oxygen in proteins.
Amino acids have different R-variable groups, and some will have Sulfur/Phosphorus in these groups (i.e Cysteine) whereas other amino acids don't (i.e Valine). If you have an amino acid which has sulfur/phorphorus in the R-variable group, inevitably you will get a protein molecule which has these elements in it. If you don't have such an amino acid, then you'll just have carbon, nitrogen, oxygen and hydrogen.