Email zadetek: Optimal allocation of resources considering two sexes and selection in two stages