What are two basic methods or approaches for counting GDP?

What are two basic methods or approaches for counting GDP? Why they should get the same answer?