The actual ray path between two points is the one for which the optical path length is stationary with respect to variations of the path. Can you explain me what is extremum path?
Similarly, Fermat's principle aka. the principle of least time is more accurately a 'principle of stationary time'.
As an example suppose you want to find the path that light takes in going from £A£ to $B$ as a result of a reflection.
There are an infinite number of possible paths and below I have shown three.
You will note that the tame taken for the light to travel from $A$ to $B$ depends on the path taken but one of the paths $AYZ$ takes a minimum (extremum) path.
Fermat says that that is the path taken by the light and it also happens to be the path such that the angle of incidence is equal to the angle of reflection.
Feynman devotes a whole chapter "Optics: The Principle of Least Time" on this topic.