A beam-foil study of lifetimes and level excitations in gallium and thallium