Disagreement and polarization in group formation