Geometric constrained variational calculus. II: The second variation (Parti I)