A Second-Order Projected Primal-Dual Dynamical System for Distributed Optimization and Learning