Second Variation Formula for Squared Distance to a Totally Geodesic Submanifold