Optimal design for consensus of second order multi-agent systems with damping term