To identify which substances are compounds from the given list, we should remember that a compound consists of two or more elements that are chemically bonded together. Here are the substances listed:
- Carbon dioxide (CO2) - compound
- Hydrogen gas (H2) - element
- Magnesium (Mg) - element
- Sodium chloride (NaCl) - compound
- Methane (CH4) - compound
- Potassium (K) - element
Based on this analysis, the compounds from the list are CO2, NaCl, and CH4.
Therefore, the correct response is: only CO2, NaCl, and CH4.