Prime Minister Theresa May stands next to Democratic Unionist Party leader Arlene Foster, as DUP MP Jeffrey Donaldson signs the agreement with Gavin Williamson, Britain's parliamentary secretary to the Treasury and chief whip.

The U.K.’s ruling Conservative Party has reached an agreement with the Northern Irish Democratic Unionist Party (DUP) that gives Prime Minister Theresa May a 14-seat parliamentary majority as she navigates her country’s departure from the European Union.

Under the deal signed Monday at 10 Downing Street, 10 DUP members of Parliament (MPs) will support May’s minority government during votes on pivotal issues. In return, Northern Ireland will receive 1.5 billion pounds ($1.9 billion) over the next two years—500 million pounds ($636 million) that had already been committed and an extra 1 billion dollars (1.27 billion). Additionally, under the deal, the government will continue to spend on government pensions and maintain winter-fuel payments throughout the U.K.

The deal became necessary because May’s gamble to call early elections failed when the Tories ended up losing their parliamentary majority two weeks ago, when they fell nine seats short. The DUP’s 10 seats give May an effective majority of 13 seats because, under the rules, the parliament’s speakers and his three deputies, do not take part in votes though they are elected MPs; additionally, Sinn Fein, the Northern Irish party that won seven seats in parliament, will not, as is its custom, take up their seats.

Arlene Foster, the DUP leader, said Monday’s agreement was “good for Northern Ireland and for the U.K.” May called it “very good.”

The deal is expected to last for five years, the tenure of the parliament, but the DUP can review it in two years.