European Union energy ministers agreed to a “dynamic” cap on natural gas prices Monday after two months of intense negotiations.