Stability of high-beta tokamaks to ballooning modes