Long-term magnetic activity of a sample of M-dwarf stars from the HARPS program II. Activity and radial velocity