Which budgetary institutions result in efficient provision of public goods? We analyze a model with two parties bargaining over the allocation to a public good each period. Parties place different values on the public good, and these values may change over time. We focus on budgetary institutions that determine the rules governing feasible allocations to mandatory and discretionary spending programs. Mandatory spending is enacted by law and remains in effect until changed, and thus induces an endogenous status quo, whereas discretionary spending is a periodic appropriation that is not allocated if no new agreement is reached. We show that discretionary only and mandatory only institutions typically lead to dynamic inefficiency and that mandatory only institutions can even lead to static inefficiency. By introducing appropriate flexibility in mandatory programs, we obtain static and dynamic efficiency. An endogenous choice of mandatory and discretionary programs, sunset provisions and state-contingent mandatory programs can provide this flexibility in increasingly complex environments.