In the integral (2) ds is not signed. Claculation of B to A whilst taking the same path yields the same result. LAB = L
BA
The extremal path will therefore be the same whatever the direction. The path taken by light from A to B or from B to A is identical.