The use of second order potentials in the theory of scattering of charged particles by atoms. VII. The partial wave formalism and elastic scattering of electrons by hydrogen and helium