Let the total work be 1
Then, According to question X takes 25 days to do 1 work.
Then work done by X in 1 day=125
Also according to question Y takes 20 days to do 1 work.
Then work doe by Y in 1 day=120
Then total work done by both of them in 1 day =120+125=9100
Then total work done by both of them 5 days=45100
Then total work left =1−45100=55100
Now, As Y can do 1 work in 25 days therefore,
Y can do 55100 work in 55100×25 days
=554 days