EU leaders reach migration deal