Variational theory of bubbly media with a distribution of bubble size—I. Liquids