Extrapolated hard thresholding algorithms with finite length for composite $$\ell _0$$ penalized problems