The U.S. Capitol building in Washington, May 23, 2023.

With days to spare before a potential first-ever government default, President Joe Biden and House Speaker Kevin McCarthy reached final agreement Sunday on a deal to raise the nation's debt ceiling and worked to ensure enough Republican and Democratic votes to pass the measure in the coming week.

The Democratic president and Republican speaker spoke with each other Sunday evening as negotiators rushed to draft the bill text so lawmakers can review compromises that neither the hard-right or left flank is likely to support. Instead, the leaders are working to gather backing from the political middle as Congress hurries toward votes before a June 5 deadline to avert a damaging federal default.