Trapezoid ABCD has bases AB and CD. Line segment EF, which is parallel to the bases, divides trapezoid ABCD into two trapezoids of equal perimeter. If AM = 10, and BN = 5, find the length EF.