First-Order Optimality Condition on Convex Sets