Calculation of the ground states of H- ion and He atom in magnetic field with a modified configuration interaction method