Assuming this is linear motion. However, you should have specified that the bodies are moving with uniform acceleration.
Let us assume $S$ is the displacement between the bodies $X,Y$ at time $t = 0$.
We know that if they collide, then the total distance that each of them have traveled should equal to $S$. We can write this as $S_X + S_Y = S$ where $S_X, S_Y$ are the total distance traveled by $X, Y$ respectively.
Using the formula $S = u_0t + \frac{1}{2}at^2$, we can get calculate equations for each of the bodies.
We know that the time of collision is equal, assuming the bodies start at the same time $t=0$. Now, $$S_X = 3t + \frac{1}{2}4t^2 = 3t + 2t^2$$
Also, $$S_Y = 7t + \frac{1}{2}2t^2 = 7t + t^2$$
Now, $$10t + 3t^2 = S$$
Given $S$, we can calculate the time using this above equation.
So $3t^2 + 10t - 400 = 0$.
We can solve this equation to give us $t=10$.