I am stuck on this problem in this calculus book I am reading. I was wondering if someone could tell me the method of finding the answer:

A mass M is drawn up a straight incline of given height h by a mass m which is attached to the first mass by a string passing from it over a pulley at the top of the incline and hangs vertically. Find the angle of incline in order that the time of ascent be a minimum.

Yours sincerely,

Bahoz Mirweis.