The lungs respond rapidly to eliminate carbonic acid (H+) in the form of carbon dioxide and water. Carbon dioxide may also be retained to increase H+ concentration.
If both PaCO2 and HCO3 are out of range, you can tell which is the primary disorder by looking if pH is alkali or acidic. The primary will be the same as the pH. So if it's acidic the primary is PaCO2 and if its alkali then it's the HCO3.