GAUSS8 2009 Problem 18

In a class of 40 students, 18 said they liked apple pie, 15 said they liked chocolate cake and 12 said they did not like either. How many students in the class liked both?

Answer Choices
A. 15
B. 10
C. 3
D. 7
E. 5