Duality of welfare and profit maximization