Legislature passes budget with little time to spare