Why did the people have to wander for 40 years? (In the Bible)

A. They had to wait for the entire generation of those who doubted God to die out.
B. It was supposed to be 10 years, but they sinned again.
C. They got lost.
D. They got entangled in battles with the kings of the wilderness.