The present invention provides pyridine and pyrazine derivatives which restore or enhance the function of mutant and/or wild type CFTR to treat chronic obstructive pulmonary disease. Pharmaceutical compositions comprising such derivatives are also encompassed.