Ensuring balance through optimal allocation of experimental units with known categorical covariates into two treatments