Senate reaches two-year spending deal to avoid shutdown