Question: Rashi ([Bemidbar 13:25](http://www.chabad.org/library/bible_cdo/aid/9941#v=25&showrashi=true)) implies that the Jews were in the Sinai Desert for 40 years in response to the spies being in the Land of Israel for 40 days.

While the spies had 40 days worth of planning to sin, and thus were punished, why were the Jews punished for merely accepting the spies’ report? What do they have to do with the 40 days?

Answer: 
The Jews were the ones who requested sending out the spies in the first place (Devarim 1:22). By accepting the spies' report when they returned they were endorsing the direction which the 40 day mission they advocated took.

They also attempted to murder Caleb and Joshua, negating 40 days of fruitful work.
According to tosafos yom tov in sota, chapter one mishna nine, d.h. vichein li'inyan hatova, the forty years was an act of kindness, not retribution. In reality the nation deserved instant death but in order that noone die under the age of sixty, Hashem stretched it out for forty years.