Which gases contribute to the greenhouse effect?

A. nitrogen and helium

B. carbon dioxide and methane

C. carbon dioxide and helium

D. nitrogen and methane