You want the center of gravity of the system to be at the edge of the table, also consider it to be your reference point.
Let the length at which the box can be placed be x,
So Equating weights to the right and left of that point,
Center of gravity of board + center of gravity of box = 0
7*(-5)+3*x = 0. Solve for x.