Why were there always shortages of consumer goods in the former soviet union?

The USSR spent about 70% of their economy's total GDP on the military. Because of this they had nationwide shortages which resulted in its collapse in 1991.