We measure magnetic quantum oscillations in the underdoped cuprates YBa$_2$Cu$_3$O$_{6+x}$ with $x=0.61$, 0.69, using fields of up to 85 T. The quantum-oscillation frequencies and effective masses obtained suggest that the Fermi energy in the cuprates has a maximum at $papprox 0.11-0.12$. On either side, the effective mass may diverge, possibly due to phase transitions associated with the T=0 limit of the metal-insulator crossover (low-$p$ side), and the postulated topological transition from small to large Fermi surface close to optimal doping (high $p$ side).