In this example we are multiplying two binomials so FOIL method can be used.
$$ \begin{aligned} \left( \color{blue}{ -x+1}\right) \cdot \left( \color{orangered}{ 8x+3}\right) &= \underbrace{ \left( \color{blue}{-x} \right) \cdot \color{orangered}{8x} }_{\text{FIRST}} + \underbrace{ \left( \color{blue}{-x} \right) \cdot \color{orangered}{3} }_{\text{OUTER}} + \underbrace{ \color{blue}{1} \cdot \color{orangered}{8x} }_{\text{INNER}} + \underbrace{ \color{blue}{1} \cdot \color{orangered}{3} }_{\text{LAST}} = \\ &= -8x^2 + \left( -3x\right) + 8x + 3 = \\ &= -8x^2 + \left( -3x\right) + 8x + 3 = \\ &= -8x^2+5x+3; \end{aligned} $$