This problem looks very similar to a very recent codeforces problem.
All we had to do was just sort both arrays as it will always produce the distinct sums but when I tried that it gave WA. I think @ssjgz is correct about the problem being wrong.
Thanks @n_18bcs6626 . I also felt that i have seen the problem somewhere else. But when you mentioned codeforces, it became all clear. This problem was copied from A. Kuroni and the Gifts. I have implemented your solution and it gives AC on the original problem. As @ssjgz said, this problem is indeed wrong. Now this thread can be closed.